url_for([:edit, @post])
正在工作和生成
/comments/123/edit
.现在我需要添加一个查询参数,而不是/comments/123/edit
这是
/comments/123/edit?qp=asdf
我试过
url_for([:edit, @post], :qp => "asdf")
但不行。
最佳答案
使用命名路由。
edit_post_path(@post, :qp => "asdf")
关于ruby-on-rails - 使用 url_for 查询参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5031591/