maxiperez
maxiperez

Reputation: 1480

Will Paginate: How change default page in links

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

Please I need their answer.

Thanks

Upvotes: 3

Views: 1355

Answers (2)

Gerry
Gerry

Reputation: 5336

Try this

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

Upvotes: 3

user142019
user142019

Reputation:

You can use :param_name to 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] 

Upvotes: 5

Related Questions