I started using Ruby on Rails today and love it.
The one thing I haven't been able to answer by myself is why the first
link below works and the second doesn't:
<%= link_to "Test Regular", { :action => "show", :id => "1" } %>
<%= link_to_remote "Test Ajax", :update => "listing", :url =>
{ :action => "show", :id => "1"} %>
I am trying to load the html at
http://localhost:3000/listings/1 into
a div on my page with the id listing. That URL works when accessed
directly or via link_to. However, when I click on the "Test Ajax"
link then the following text loads in my listing div: "Unknown action:
No action responded to 1". What really puzzles me is that I even see
in FireBug that the when I click on the "Test Ajax" link that a
request is issued to the correct URL:
http://localhost:3000/listings/1
The source generated by Rails is:
<a href="#" onclick="new Ajax.Updater('listing', '/listings/1',
{asynchronous:true, evalScripts:true, parameters:'authenticity_token='
+ encodeURIComponent('fda1badbcc7be1ff0d55829e684ecbe00579a97b')});
return false;">Test Ajax</a>
<a href="/listings/1">Test Regular</a>