Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

button_to_remote aliases submit_to_remote

#581

In a discussion on the rails-core mailing list (http://groups.google.com/group/r...) the majority of people thought that button_to_remote would make a good alias for the existing submit_to_remote. There's link_to/link_to_remote so button_to/button_to_remote would be more consistent than button_to/submit_to_remote.

I've attached the patch. I didn't feel it necessary to write a test since we're only aliasing a method and I checked back and form_remote_for isn't tested either.

Reported by Clemens Kofler · July 9th, 2008 @ 07:55 AM

State: resolved
Milestone: none
Assigned to: Tarmo Tänav Tarmo Tänav
Importance: none

Activity

  1. Michael Koziarski
    Michael Koziarski
    • Assigned user set to Michael Koziarski
    • Tag changed from actionpack, actionview, helper, patch, prototype to actionpack, actionview, enhancement, helper, patch, prototype, tiny

    July 9th, 2008 @ 10:15 AM

  2. DHH
    DHH
    • State changed from new to committed

    July 9th, 2008 @ 04:04 PM

  3. Pratik
    Pratik
    • State changed from committed to resolved

    July 10th, 2008 @ 01:02 AM

  4. Tarmo Tänav
    Tarmo Tänav

    Hey everyone,

    Looks like there was a conflict between this change and one added later : http://github.com/rails/rails/co... (ignore the fact that said commit does nothing because the commit introduced by this ticket, albeit earlier, overrides all methods added by it).

    My question is, why should button_to_remote use submit_to_remote style API when it could easily use link_to_remote style and thus become (by default) usable without a containing form?

    Is there any benefit to keeping submit_to_remote and button_to_remote as aliases instead of separating button_to_remote to be something like link_to_remote and submit_to_remote as a specialization of that button_to_remote which applies the :with => "Form.serialize(this.form)" and :name => name options?

    October 6th, 2008 @ 02:19 PM

  5. Michael Koziarski
    Michael Koziarski
    • State changed from resolved to open
    • Milestone cleared.

    Let's make sure we have a nice api before we cut the 2.2 release.

    October 6th, 2008 @ 03:45 PM

  6. Clemens Kofler
    Clemens Kofler

    Tarmo,

    on the Pro side I see the benefits of the change you're suggesting because it makes plenty of sense. Personally, I wouldn't have implemented submit_to_remote as it is in the first place but I guess we're touching some really old Rails code base here.

    On the other hand, the reason why I originally opened this ticket was because of the inconsistency. Back then, I was surprised to find that link_to had its counterpart link_to_remote whereas button_to didn't have one - at least not by name. Making button_to_remote behave totally different than button_to might lead to some amount of confusion. Moreover, without a containing form, the button wouldn't degrade gracefully with JS turned off. I'm not sure if the current solution degrades gracefully but that's certainly a downpoint.

    In short: I have a hard time deciding which I find makes more sense - so I guess this is up to you guys!

    October 6th, 2008 @ 11:56 PM

  7. Michael Koziarski
    Michael Koziarski
    • Assigned user changed from Michael Koziarski to Pratik

    Moving this to pratik as I may be on holiday during the RC

    October 9th, 2008 @ 05:12 PM

  8. DHH
    DHH
    • Assigned user changed from Pratik to Tarmo Tänav

    I'm +1 on making button_to_remote work like link_to_remote and keeping submit_to_remote as it always was.

    October 9th, 2008 @ 05:25 PM

  9. Michael Koziarski
  10. Pratik
    Pratik
    • State changed from open to resolved

    October 16th, 2008 @ 11:01 AM