use*_*111 3 ruby-on-rails ruby-on-rails-3
我想我的转换link_to标签的link_to do块,作为讨论在这里.我不确定:remote => true选项应该去哪里.
原版的:
<%= link_to "Title", {:controller => "users", :action => "edit", :id => u.id }, :remote => true %>
Run Code Online (Sandbox Code Playgroud)
到目前为止,这是为link_to do块工作,但我不知道放在哪里:remote => true.它在options块或html_options中不起作用.
<%= link_to (options = {:controller => "users", :action => "edit", :id => u.id}) do %>
Link contents
<% end %>
Run Code Online (Sandbox Code Playgroud)
没有测试过,但我认为正确的方法是
<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id}), :remote => true) do %>
Link contents
<% end %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2067 次 |
| 最近记录: |