I am struggling with this. Using sinatra, ruby and Sequel, I attempting to implement paging.
The query is:
@items = DB[:candidates].order(:id).paginate(1, 10)
which works,it produces the desired number of records and the <%= will_paginate(@items) %> link generates the following HTML:
← Previous 1 2 3 4 5 Next →
When I click on the number or next link in my browser address bar I get, for exampl:
http://localhost:4567/candidate?page=3`
but the page does not change!
The ruby code is:
get '/candidate' do
@items = DB[:candidates].order(:id).paginate(1, 10)
erb :candidate
end
Any ideas? All help gratefully received. Is there a problem with param passing? The query
@items = DB[:candidates].order(:id).paginate(page: params[:page], 10)
does not work and produces an error message.
Thank you.