ruby on rails - How to add an anchor at the end of paginate url in will_paginate -


this question has answer here:

hello have problem while using will paginate gem.i want pagination opened under anchor tab "volunteers".

the link pagination generates "/project_name?page=2" want include anchor tab in link.like link should "/project_name?page=2#volunteers". how can link every time user clicks on next page?

in projects_controller.rb

def show     @volunteers=@volunteers.paginate(:page => params[:page], :per_page => 3 )     end 

in show.html.slim

=will_paginate @volunteers 

i got solution can add anchor links page redirects desired tab.in view replace will_paginate @volunteers  will_paginate @volunteers,:container => false,:params => {:anchor => "volunteers"} 

this generate new url '/projects?page=2#volunteers'.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -