使用redirect_to添加url参数

Ste*_*eve 9 ruby-on-rails

是否可以使用此类型的redirect_to传递url参数?

redirect_to contact_path(@contact), :show_family => 'yes'
Run Code Online (Sandbox Code Playgroud)

我想要一个导致以下结果的网址:

/contacts/1?show_family=yes
Run Code Online (Sandbox Code Playgroud)

Ale*_*ner 14

是的,只需将查询字符串参数传递给contact_path:

redirect_to contact_path(@contact, :show_family => 'yes')
Run Code Online (Sandbox Code Playgroud)