Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3641 (new enhancement)

Opened 4 years ago

Last modified 2 years ago

[PATCH] button_to_remote helper

Reported by: donald.piret@synergetek.be Assigned to: David
Priority: low Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc: tarmo, TylerRick, nicwilliams

Description

From the book Agile Web development with Rails I know that all destructive actions should be put behind a POST request, which the button_to helper is very handy for, however I have the feeling that a button_to_remote is sorely lacking, wouldn't it be interesting to have this?

Attachments

button_to_remote_helper.diff (3.5 kB) - added by brad@bradleyboy.com on 03/23/06 05:40:13.
button_to_remote_helper.2.diff (3.8 kB) - added by josh on 03/10/07 23:00:14.
Updated patch against [6372].

Change History

02/09/06 08:41:38 changed by BobSilva

  • priority changed from normal to low.

I think the response you will get is that form_remote will do this with a submit button.

02/22/06 23:06:44 changed by donald.piret@synergetek.be

Agreed, just like button_to will produce the same thing as a form with a button, that's why it's called a helper. I just thought that one of ruby, and also one of rail's main advantages was the no surprise motto: consistency of code across the language and across the API. If there's a link_to and a link_to_remote, a form_tag and a form_remote tag, I'd also expect there to be a button_to and button_to_remote, but surprise!: it's not there. Was just pointing that out.

03/23/06 05:39:37 changed by brad@bradleyboy.com

  • summary changed from button_to_remote helper to [PATCH] button_to_remote helper.

I find this interesting as well, since it also keeps things in an inline element, instead of a block (like a form). Anyway, this is my first patch (test are included) and it allows you to use button_to_remote just as you would link_to_remote....

03/23/06 05:40:13 changed by brad@bradleyboy.com

  • attachment button_to_remote_helper.diff added.

03/10/07 23:00:14 changed by josh

  • attachment button_to_remote_helper.2.diff added.

Updated patch against [6372].

03/10/07 23:00:46 changed by josh

  • keywords set to verified.
  • version changed from 1.0.0 to edge.
  • milestone set to 1.2.3.

07/20/07 02:26:28 changed by nzkoz

  • keywords deleted.

Removing the verified keyword, to get it back follow the instructions of http://wiki.rubyonrails.org/rails/pages/PatchRequirements

08/07/07 01:09:47 changed by tarmo

+1, I wrote (not knowing about this ticket) the exact same helper for a project :)

08/07/07 01:12:41 changed by tarmo

  • cc set to tarmo.

10/01/07 03:33:01 changed by TylerRick

  • cc changed from tarmo to tarmo, TylerRick.

01/22/08 14:35:37 changed by nicwilliams

  • cc changed from tarmo, TylerRick to tarmo, TylerRick, nicwilliams.

+1 - I haven't tested this against Rails 2.0, but I agree there should be a button_to_remote equivalent.

01/22/08 14:36:12 changed by nicwilliams

  • milestone changed from 1.2.7 to 2.1.

02/11/08 18:35:46 changed by kampers

  • milestone changed from 2.1 to 2.x.

03/12/08 16:41:21 changed by pelargir

+1