我正在尝试将我的 link_to
标记转换为 link_to do
block ,如 here 所述.我不确定 :remote=>true 选项应该放在哪里。
原文:
<%= link_to "Title", {:controller => "users", :action => "edit", :id => u.id }, :remote => true %>
到目前为止,这适用于 link_to do
block ,但我不知道在哪里放置 :remote=>true。它在选项 block 或 html_options 中都不起作用。
<%= link_to (options = {:controller => "users", :action => "edit", :id => u.id}) do %>
Link contents
<% end %>
最佳答案
没有测试,但我认为正确的方法是
<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id}), :remote => true) do %>
Link contents
<% end %>
关于ruby-on-rails - Rails link_to 用 remote=>true 阻塞?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16205457/