I have a user model and image model and having has_many relationships.
I have 18 records in images table. Now thing is:
@images = @user.images.paginate(:page => params[:page],:per_page=> 12)
p @images.count //output is always 18
Number of images is 18, always
For first page is 18 then for second page is again 18. Why is it so? It should be 12 for first page and then 6 for second page.
PS: It showing only 12 and 6 records but counter is not proper. I want to get number of records on that page only. Basically for last page (considering order by id DESC) counter my vary from 1-12 and I am interested in that counter.
What does length return? Count is going to hit the db,
Try this instead? I think it will work better with paginate