Reputation: 2141
I'm trying to convert my link_to
tag to a link_to do
block, as discussed here. I'm not sure where the :remote=>true option should go.
Original:
<%= link_to "Title", {:controller => "users", :action => "edit", :id => u.id }, :remote => true %>
So far this is working for the link_to do
block, but I don't know where to put :remote=>true. It doesn't work either in the options block or html_options.
<%= link_to (options = {:controller => "users", :action => "edit", :id => u.id}) do %>
Link contents
<% end %>
Upvotes: 3
Views: 2160
Reputation: 2141
Got it! Correct syntax is
<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id})), :remote => true do %>
Link contents
<% end %>
Thanks.
Upvotes: 4
Reputation: 20116
Didn't tested, but I think the right way is
<%= link_to (url_for({:controller => "users", :action => "edit", :id => u.id}), :remote => true) do %>
Link contents
<% end %>
Upvotes: 6