PP Junty wrote: > ok, i made a little plugin with this functionality, it is attached. > definitely not a pro solution but may be useful. could you test > it and see if it is working? if it is i could publish it on github. > this plugin also alter another behavior that i find annoying, which is: > when you request a page greater than the total pages will_paginate > returns an empty page. that happens specially when the last item of > a page is deleted. the extension will always return the last page in > this case.
Thanks for the code. Didn't catch the attachment at first sight. I tested the plugin and it works quite fine. However, I have a small problem while selecting a specific page. :page => :last always redirects to the last page, even if a parameter is given. I tried to check the parameter before, but this throws an error as well: if (params[:page].nil?) @replies = @bullet.replies.paginate :page => :last, :order => 'created_at ASC', :per_page => 10 else @replies = @bullet.replies.paginate :page => params[:page], :order => 'created_at ASC', :per_page => 10 end Throws: comparison of String with 2 failed /Users/patrick/Sites/insight/vendor/plugins/will_paginate_last/lib/will_paginate_last/finder.rb:39:in `>' /Users/patrick/Sites/insight/vendor/plugins/will_paginate_last/lib/will_paginate_last/finder.rb:39:in `paginate' -- 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 -~----------~----~----~----~------~----~------~--~---