[ACCEPTED]-Passing param values to redirect_to as querystring in rails-query-string

Accepted answer
Score: 41

The 'Record' form of redirect_to uses the second argument 5 only for the response status. You'll have 4 to use another form of redirect_to, like 3 the 'String' form. e.g.:

redirect_to thing_path(@thing, :foo => params[:foo])

which will work 2 for nested params[:foo] params like you mentioned. Or, as 1 Drew commented below, you can use polymorphic_url (or _path):

redirect_to polymorphic_path(@thing, :foo => params[:foo])
Score: 4

To add to Jordan's answer:

If you don't know 4 what type of object @thing might be, you can use 3 the universal polymorphic_url method. This is the method 2 that is called internally when you pass 1 in an object to redirect_to anyway.

More Related questions