我正在使用旧版应用程序,并试图将其升级到Rails 3.目前,当我执行搜索时,我收到了URL:http://localhost:3000/search/external_search/?keyword=argentina
。但是,当我尝试过滤结果时,我得到了http://localhost:3000/search/external_search/?order=Name:ASC
,而URL中没有关键字参数。由于没有关键字参数,过滤器不起作用。这是搞乱了我的过滤器,所以我决定增加一个隐藏字段标签Rails 3:如何混合形式参数和URL参数?
<%= hidden_field_tag 'keyword', @search.text %>
这使得它的工作,但URL并没有改变。我希望它看起来像:
http://localhost:3000/search/external_search/?keyword=argentina&order=Name:ASC
正是我会做到这一点?在控制器或表单中?
的'params'散列并不关心其中的变量从何而来。你的控制器代码是什么? – 2013-05-13 14:49:54