Max Williams wrote: > If you have an object that you have paginated, you can get the number of > pages with .total_pages: this will be the same as the number of the last > page. > > Presumably when you're looking at the topic, you've already loaded it's > replies anyway? > > eg > > @topic = Topic.find(params[:id]) > @replies = @topic.replies.paginate(:page => 1, :per_page => 20) > > last_page = @replies.total_pages
Well, the problem is that the replies are not yet paginated. It's a summary on a landing-page and the last three replies should show up for each topic. The total_pages attribute is not know at this point. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

