Hi, I’m really new to RoR and web development in general, so if I’m
going about this in a really stupid manner, let me know.
I have a search form that redirects to ‘List’ when you hit search.
‘List’ looks at the array of search parameters passed through, and uses
the paginator to return the appropriate results from my MySql database.
Here’s what I’m doing in my ‘List’ def, where ‘accssn’ is the array of
search parameters :
acc = params[:accssn]
if(@acc != nil)
@type = acc[:type]
@gene = acc[:gene]
@accssn_pages, @accssns = paginate :accssns, :per_page => 25,
:conditions => [“type = ? AND gene = ?”,@type,@gene]
end
The problem is, in list.rhtml I have links to next page and previous
page, in which I simply overwrite the parameters and change the page
number:
<%= link_to ‘Next page’, { :overwrite_params => { :page =>
@accssn_pages.current.next} } if @accssn_pages.current.next %>
But the search array doesn’t get passed to page 2 or whatever correctly,
and instead of being passed as an array it is passed as one long string.
So ‘acc = params[:accssn]’ returns this long string instead of the array
that the original search returned.
Any help would be greatly appreciated, thanks!