link_to_remote should behave like remote_form_for
Reported by Clemens Kofler | June 30th, 2008 @ 03:35 PM
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
-
Clemens Kofler June 30th, 2008 @ 08:22 PM
Just realized that I accidentally posted in the Rails plugins section instead of core. I just posted it to the core -> can be set to invalid and closed.
-
Joshua Peek July 13th, 2008 @ 08:42 PM
- → State changed from new to invalid
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
