繁体   English   中英

Rails link_to用remote => true做阻塞?

[英]Rails link_to do block with remote=>true?

我想我转换link_to标记为link_to do块,作为讨论在这里 我不确定:remote => true选项应该去哪里。

原版的:

<%= link_to "Title", {:controller => "users", :action => "edit", :id => u.id }, :remote => true %>

到目前为止,这是为link_to do块工作,但我不知道放在哪里:remote => true。 它在options块或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 %>

得到它了! 正确的语法是

<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id})), :remote => true do %>
     Link contents
<% end %>

谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM