如何在link_to
块声明中实现查询字符串和 URL 参数?现在,我有这个,它有效:
<%= link_to 'Edit', :edit, :type => 'book', :id => book %>
以上工作,并输出:
http://localhost:3000/books/edit/1?type=book
我想做的是这样的:
<% link_to :edit, :type => 'book', :id => book do %>
...
<% end %>
但上述格式输出:
http://localhost:3000/books/edit/
这不是我要找的......我希望它像前面的例子一样输出一个 URL。
我怎样才能做到这一点?