I am cross posting this from the Questions of the day Wiki - its driving me nuts - i have a workround using routes and duplicated code but want a better answer to this :-) - Hope you peeps can help. S. ## *Question*: I am trying to build a URL to a controller method that normally accepts input from a form. The form values usually come in a hash like <pre> <code> [:search][:searchterm] </code> </pre> and i have written code to use that. Works great.Now from another page i want to submit a call and data using something like the *url_for* function in an RHTML page. Basically like using a name value pair in traditional web coding.I am trying to use <pre> <code> <%= url_for(:controller => "portal", :action => "search_general",[:search][:searchterm] => object.tag) %> </code> </pre> <code> </code>but this of course borks. Anyone know how to encode hash param values in *url_for* Cant find anything on this ( my search terms may be poor). I am sure somebody needs to do this as well.... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I just spotted a syntax error, does that help? <%= url_for(:controller => "portal", :action => "search_general", params[:search][:searchterm] => object.tag) %> Or are you trying to do this: <%= url_for(:controller => "portal", :action => "search_general", "search[searchterm]" => object.tag) %> ? Let me know if that helps :) On Oct 22, 2005, at 8:45 PM, Machinecast Global wrote:> > <%= url_for(:controller => "portal", :action => "search_general", > [:search][:searchterm] => object.tag) %>Rob