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. -- Posted via http://www.ruby-forum.com/.
Lindsay Boyd
2006-May-11 19:49 UTC
[Rails] Re: Including dynamic list of params in link_to
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 -- Posted via http://www.ruby-forum.com/.
Apparently Analagous Threads
- Displaying related entries by tags - HELP!
- Is there a link_to ''external url''?
- Security issue dealing with comment posting - anyone?
- build matrix with the content of one column of a data frame in function of two factors
- params[hash] and link_to.... easy question... but I am stupid :)