如何在 URL 中放置搜索参数?
如何获取表单来提交 url 中的参数,以便呈现的页面将包含查询(rails 2.3)?
像这样的事情:
example.com/search?name=john&age=25&city=atlanta
简单,我知道,但我不知道该怎么做......:)
谢谢。
How do I get a form to submit it's params in the url, such that the rendered page will contain the query (rails 2.3)?
Something like this:
example.com/search?name=john&age=25&city=atlanta
Simple, I know, but I'm not sure how to do it... :)
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是 Rails 特有的。只需将表单的
method
属性设置为GET
即可。This is not specific to Rails. Just set the
method
attribute of the form toGET
.正如吉米所说:确保您的表单标签如下所示:
as stated by Jimmy: make sure your form-tag looks like this:
如果您使用路由助手来执行此操作,请使用:
If you're using routing helpers to do this use: