ruby on rails - Kaminari wrong url in the view -


i've found similar questions kaminari, none of answers worked on machine.

basically, when i'm paginating, number of pages correct, url i'm redirected wrong. 1 below action in controller

def index_offered    @machines = machine.not_sponsored.offered.order("created_at desc").page(params[:page]).per(5)  end 

now, when implement kaminari in view

<%= paginate @machines%> 

i obtain 3 pages (correct) of pagination, links are:

0.0.0.0:3000/?page=2 0.0.0.0:3000/?page=3 

while should be

0.0.0.0:3000/offered-machinery?page=2 0.0.0.0:3000/offered-machinery?page=3 

could catch nested in routing? here route regards index_offered action

  match 'offered-machinery' => 'machines#index_offered', :as => :offered_machinery 

i've tried pass params in view typing

<%= paginate @machines , :params => {:controller => "machines" , :action => 'index_offered'}%> 

and uncommented line in routes.rb:

   match ':controller(/:action(/:id))(.:format)' 

but in case, obtain these urls instead:

0.0.0.0:3000/machines/offered-machinery?page=2 0.0.0.0:3000/machines/offered-machinery?page=3 

how work around this?

try change de controller name "machines":

{:controller => "machines" , :action => 'index_offered'}%>

Comments