Including dynamic list of params in link_to

How do I include all incoming URL parameters (i.e.
list_content.rhtml?content_id=23) in my link_to statements?

I know I can include specific parameters in the link_to, by using
“:variable_name => 123” in the link_to statement… But what If I
dont’ know what the incoming parameters will be… and I simply want to
include them along with any other specific variables I choose.

I am using sortable columns in a table, and need to reload the page –
and I’m trying to use some common functions for this… .but I’m getting
hung up with knowing what the incoming params are and including them on
all my links.

Brandon Kelly wrote:

How do I include all incoming URL parameters (i.e.
list_content.rhtml?content_id=23) in my link_to statements?

link_to :content_id => params[:content_id], :another =>
params[:another], :andanother => params[:andanother], etc

If a parameter is not sent in your http get request, the param value is
nil, ie param[:another].nil? is true. Your logic in the controller’s
action (eg ‘list_content’) should handle the different combinations of
parameter values.

Lindsay

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