This project is archived and is in readonly mode.
link_to_remote should behave like remote_form_for
One thing that has bugged me for quite some time now is that link_to_remote and remote_form_for behave differently regarding their target. If you don't specify the :action attribute with remote_form_for it automatically gets populated with the URL of the Ajax.Request. But if you don't specify :href for a link_to_remote it simply get a hash mark for the href part of the resulting link.
I find that in most cases I handle both, AJAX and non-AJAX requests, with the same controller and action. Therefore, I think that setting the href attribute to the same value as the :url (as is the case for remote_form_for) would make a valid default.
I've attached a patch that fixes said problem and I've also updated the old tests to reflect the change plus added a new one to test that the :href attribute can be manually overwritten. Finally, I've updated the documentation for the method.
Apart from the updated tests, the change doesn't produce any errors in the ActionPack.
What still needs to be considered is handling of POST/PUT/DELETE as they break the "rules". But then again, this is the responsibility of the web developer anyways.
Comments and changes to this ticket
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Tickets have moved to Github
The new ticket tracker is available at https://github.com/rails/rails/issues