jahrichie
jahrichie

Reputation: 1235

Rails 3.2 and will_paginate, customize generated paginate links

I have a single page site that has different controller actions in a carousel. Works the way I like right now. I'd like to paginate the results. By default will_paginate is generating links that look like this:

/links/new?page=3#make-links

I need this path to look like:

/?page=3#show-links

I have this method in my controller that I call in any action that needs pagination:

@links = Link.paginate(:page => params[:page], :per_page => 5)

and in my view I call this, with a helper to render the pagination in a sexy twitter bootsrap style:

<%= will_paginate @collection, :renderer => BootstrapPagination::Rails %>

Upvotes: 0

Views: 476

Answers (1)

jahrichie
jahrichie

Reputation: 1235

I handled this in my routes file by doing something like so:

  resources :links
    get "(?page=:page)#show-links" => "links#index", :as => :links

BOOYA!

Upvotes: 1

Related Questions