In Rails 3, is there a way to link to a controller’s action using ajax without having a named route?
I tried <%= link_to 'Reload', '#', url_for(:action => :reload, :id => @user.id), :remote => true, :method => 'post' %>
but it returns with the error No route matches {:controller=>"users", :id=>2, :action=>"reload"}
My main concern is that I don’t want the action to be called by someone typing in a route in the address bar. Is there another way to go about this?
Thanks!
Tim
if your
Userresource is in yourroutes.rbfile then you need to add a route to the 7 restful actions.That will give you the route to work with
and that should work for reloading your user object
that will show you all your routes you can work with