I have 3 tables PostText
, PostImage
and PostVideo
.
Now I am combining data from all the above three table into a single array called userposts
.
Now from userposts
I want to access only 10 records starting with offset 15.
How can I do that?
I tried out userposts.first(10)
. It gives me first 10 records but I want 10 records starting from offset-15.
thanks in advance.
You should use ary[start, length] → new_ary or nil
method.
..returns a subarray starting at the start index and continuing for length elements,
userposts[10, 15]