So I have a search form that returns a Kaminari paginated array. The first page always returns a list of results, however the "GET" of all subsequent page links returns no results and I'm not sure why!
Here are my search methods in my controller
def writer_search
@writers = Kaminari.paginate_array(@results).page(params[:page]).per(10)
end
def writer_search_submit
@results = #my big array of results, this part works fine
@writers = Kaminari.paginate_array(@results).page(params[:page]).per(10)
render 'writer_search'
end
View Code
=form_tag(writer_search_submit_path, :method => 'post') do
%input{:name => 'keywords', :id => 'keywords', :value => params[:keywords]}
= submit_tag "Search"
- @writers.each do |writer|
#show the results
= paginate @writers
Server Log when clicking a pagination link
Started GET "/editors/writer_search?commit=Search&keywords=business&page=2"
Processing by EditorsController#writer_search as HTML
Parameters: {"commit"=>"Search", "keywords"=>"business", "page"=>"2", "utf8"=>"✓"}
The first rendered page has the first 10 results of my array (in this case, there are hundreds of results). Clicking on any of the pagination links makes a GET and returns a page with no results.
Any ideas?