我正在尝试将link_to
代码转换为link_to do
代码块,正如here所述。我不确定:remote => true选项应该去哪里。
原件:
<%= link_to "Title", {:controller => "users", :action => "edit", :id => u.id }, :remote => true %>
到目前为止,这适用于link_to do
块,但我不知道放在哪里:remote =&gt; true。它在选项块或html_options中都不起作用。
<%= link_to (options = {:controller => "users", :action => "edit", :id => u.id}) do %>
Link contents
<% end %>
答案 0 :(得分:6)
未经测试,但我认为正确的方法是
<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id}), :remote => true) do %>
Link contents
<% end %>
答案 1 :(得分:4)
知道了!正确的语法是
<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id})), :remote => true do %>
Link contents
<% end %>
感谢。