Will paginate: how to change the default page in links

I have two partial. The first ones have a common will_paginate, but in the second will_paginate I need to change the links (url by default) generated by will_paginate.

Please, I need their answer.

thank

+3
source share
2 answers

try it

will_paginate(@some_collection, :params => { :controller => "foo", :action => "bar" })
+2
source

You can use :param_nameto change the query string parameter:

<%= will_paginate @posts, :param_name => :posts_page %> 
<%= will_paginate @comments, :param_name => :comments_page %> 

Note that in your controller you must also change this:

@posts = Post.paginate :page => params[:posts_page] 
@comments = Comment.paginate :page => params[:comments_page] 
+4
source

Source: https://habr.com/ru/post/1790997/


All Articles