:params, pagination_links, and the select helper form

I have this page that renders a table of data that I’d like to display
in multiple pages. I’m trying to use pagination_by_sql and
pagination_links, but I have a problem figuring out how to re-recreate
the url generated by a select helper form in order for the pagination
links’ parameters to be in the right format.

To elaborate, I have data that is generated by form select helpers
like the following:

<%= select(:filter_key, :received_at, @select_dates ) %>
<%= select(:filter_key, :user, @select_users ) %>

So, when submitted, the url will look like this:


And subsequently, the params hash becomes:

params =>

Notice how filter_key is a hash containing the keys “user” and
“received_at”. In my controller, I set
@filter_keys = params[:filter_key]
so that I could parse the data to create my sql query. This makes
@filter_keys to be

Now, in the resulting page, I used pagination_links to give me the
<%= pagination_links(@audit_record_pages,:params => {“filter_key” =>
{@filter_keys}}) %>

If I hover over the link to page 2, I see what’s going to be passed
through the url:

which is different from the original url. And so, my code breaks
when trying to parse out

Seeing how pagination_links flattens out the hash in a manner
different from when using form selects, are there any suggestions on
how I can get around this?

Thanks in advance,


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs