Passing param values to redirect_to as querystring in rails
The 'Record' form of redirect_to
uses the second argument only for the response status. You'll have to use another form of redirect_to, like the 'String' form. e.g.:
redirect_to thing_path(@thing, :foo => params[:foo])
which will work for nested params[:foo]
params like you mentioned. Or, as Drew commented below, you can use polymorphic_url (or _path):
redirect_to polymorphic_path(@thing, :foo => params[:foo])
To add to Jordan's answer:
If you don't know what type of object @thing
might be, you can use the universal polymorphic_url
method. This is the method that is called internally when you pass in an object to redirect_to
anyway.