This project is archived and is in readonly mode.

#581 ✓resolved
Clemens Kofler

button_to_remote aliases submit_to_remote

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

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.

Comments and changes to this ticket

  • Michael Koziarski

    Michael Koziarski July 9th, 2008 @ 10:15 AM

    • Assigned user set to “Michael Koziarski”
    • Tag changed from actionpack, actionview, helper, patch, prototype to actionpack, actionview, enhancement, helper, patch, prototype, tiny
  • DHH

    DHH July 9th, 2008 @ 04:04 PM

    • State changed from “new” to “committed”
  • Pratik

    Pratik July 10th, 2008 @ 01:02 AM

    • State changed from “committed” to “resolved”
  • Tarmo Tänav

    Tarmo Tänav October 6th, 2008 @ 02:19 PM

    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?

  • Michael Koziarski

    Michael Koziarski October 6th, 2008 @ 03:45 PM

    • State changed from “resolved” to “open”
    • Milestone cleared.

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

  • Clemens Kofler

    Clemens Kofler October 6th, 2008 @ 11:56 PM

    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!

  • Michael Koziarski

    Michael Koziarski October 9th, 2008 @ 05:12 PM

    • Assigned user changed from “Michael Koziarski” to “Pratik”

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

  • DHH

    DHH October 9th, 2008 @ 05:25 PM

    • 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.

  • Michael Koziarski
  • Pratik

    Pratik October 16th, 2008 @ 11:01 AM

    • State changed from “open” to “resolved”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages