I'm very new to RoR development and am working through the
developer.apple.com tutorials to try to get a good enough working
knowledge to be able to start my own project. Unfortunately, i'm using
Rails 3 and the tutorials are aimed at a Rails 2 environment.
I've been able to get a fair way through the tutorials, working out some
of the simpler changes myself (changes to the routing API were
interesting), but i've hit a point where i'm stuck and google hasn't
been able to help me.
I'm currently working through the "Spicing it up with Ajax" section of
http://developer.apple.com/tools/customizeonrailsleopard.html but am
unable to successfully convert the Rails 2 link_to_remote syntax into
Rails 3. I understand that the method is depreciated and that i should
use link_to with a :remote => true option specified, but the arguments
link. Instead, when i click one of the links, the whole page is
refreshed and the arguments appear in the address bar (instead of an
Ajax call). E.g.
My _expenses.erb event looks like so:
...<% for expense in expenses -%>
<tr id="<%= dom_id(expense) %>">
<%= link_to expense.vendor.name, expense.vendor %>
<%= number_to_currency(expense.amount, :unit => "£") %>
<%= link_to 'delete',
:url => event_expense_url(event, expense),
:confirm => 'Are you sure?',
:method => :delete,
:remote => true %>
<% end -%>...
and my application.html.erb file:
<%= stylesheet_link_tag :all %>
<%= csrf_meta_tag %>
<%= yield %>
I'd be very grateful if anyone could offer some advice. Apologies if the
source code is too long for the forum.