Pass the params please


#1

I’m not figuring out an easy way to do this.

I’m trying to paginate and keep the params from my ‘find’ without making
it a fully blown method.

my params are
[:right][:name]
[:right][:controller]
[:right][:action]

view code is relatively simple pagination stuff…

<%= link_to ‘Next page’, {
:page => @right_pages.current.next,
:params => params
} if @right_pages.current.next %>

If I do it like shown above, my params are nameactioncontrollerclients
and that obviously doesn’t work.

If I do it like

:params[:right] => params[:right]

that returns an error

:params => params[:right]

wipes out other params

Suggestions?

Craig


#2

My experience is that the built-in helpers don’t do a great job of
preserving multi-dimensional hashes as you’re trying to do below. You’ll
probably need to write a helper method. And if you DO write a helper
method,
or otherwise figure this out, please please share the solution :slight_smile: I’ve
had
the same problem but haven’t gotten around to fully addressing it.

Daniel


#3

Hey, at least you defined the terminology that wasn’t coming to me to
define the problem.

In this instance, I am not interested in working out a solution since I
was looking for a Q&D method which as you suggest, isn’t there.

I can obviously flatten the params hash within the controller or pass
them to session variables, etc. but I wanted Q&D and thus, have remedied
it by setting the ‘per page => ridiculously high’ since this is a simple
list that will never be all that long and usage is only the system
administrator (me).

Thanks

Craig