array issues

Hey all, When I do: @posts = Post.find(:all)[0,5] it gives me the first 5 posts

But when I do: @posts = Post.find(:all)[10,20] it gives me something like 20 posts or more, shouldn’t this give me only 10 post from 10 to 20?

what am I doing wrong?

thanx in advance

Pat

No, on an array it works like this..

array[offset, length]

So Post.find(:all)[10,20] will give you 20 posts starting at number 10.

_Kevin

$ ri Array# --------------------------------------------------------------- Array#       array[index] -> obj or nil       array[start, length] -> an_array or nil       array[range] -> an_array or nil       array.slice(index) -> obj or nil       array.slice(start, length) -> an_array or nil       array.slice(range) -> an_array or nil