Hi, I wonder why scaffolding uses a link_to tag for the destroy links. Seems like these should be POST requests with button_to. The Rails book dedicates pages 335-337 to this very issue. Peter
Peter Michaux wrote:> Hi, > > I wonder why scaffolding uses a link_to tag for the destroy links. > Seems like these should be POST requests with button_to. The Rails > book dedicates pages 335-337 to this very issue. > > PeterThe scaffold is intended to be a quick and dirty implementation to get things up and running. The intent is for the user to gradually replace scaffold operations with their own (and presumably better) code. In development mode That said, I''m certain a signficant chunk of scaffold code will not be replaced in some live applications. It would certainly make sense to put in minor fixes like that as an example of good coding practices at least. My guess is that the scaffold hasn''t been updated in quite some time and that this is a legacy thing. FYI, you can make ''link_to'' generate post requests instead of get requests, so you don''t really need to use ''button_to''. -- Posted via http://www.ruby-forum.com/.
Kevin: How do you get link_to to generate a post request? That would seem useful in light of this discussion. bruce On 8-Jan-06, at 11:47 AM, Kevin Olbrich wrote:> Peter Michaux wrote: >> Hi, >> >> I wonder why scaffolding uses a link_to tag for the destroy links. >> Seems like these should be POST requests with button_to. The Rails >> book dedicates pages 335-337 to this very issue. >> >> Peter > > The scaffold is intended to be a quick and dirty implementation to get > things up and running. The intent is for the user to gradually > replace > scaffold operations with their own (and presumably better) code. In > development mode > > That said, I''m certain a signficant chunk of scaffold code will not be > replaced in some live applications. It would certainly make sense to > put in minor fixes like that as an example of good coding practices at > least. > > My guess is that the scaffold hasn''t been updated in quite some > time and > that this is a legacy thing. > > FYI, you can make ''link_to'' generate post requests instead of get > requests, so you don''t really need to use ''button_to''. > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
David Heinemeier Hansson
2006-Jan-08 20:12 UTC
[Rails] Re: scaffold uses link_to for destroy
> How do you get link_to to generate a post request? That would seem > useful in light of this discussion.link_to "Destroy", { :action => "destroy" }, :post => true -- David Heinemeier Hansson http://www.loudthinking.com -- Broadcasting Brain http://www.basecamphq.com -- Online project management http://www.backpackit.com -- Personal information manager http://www.rubyonrails.com -- Web-application framework