i had the same problem. some people already asked this feature to
be added to will_paginate, apparently the developer doesn't think
it is a good idea. check this:

http://groups.google.com/group/will_paginate/browse_thread/thread/9c4ff183a4271bde/3f71f7dc31a54767

for my projects i made an extension to make will_paginate accept
:page => :last.

Patrick Heneise wrote:
> 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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to