Yikes Roy... you just got yourself a first class ticket to Merb/Web hell :p
You are making a GET request on an action that should receive a POST request. You basically went around a protection set in the framework to help you do the "right" thing. It's not a huge deal but it's definitely not the right thing to do. - Matt On Wed, Jan 7, 2009 at 10:09 PM, Roy Wright <[email protected]> wrote: > > > On Jan 7, 2009, at 11:34 PM, Matt Aimonetti wrote: > > > Roy, if you look at the example I put in the wiki: > > resource(@article, :delete) # GET => delete > > > > > > A GET request to the delete action won't destroy the object, it > > should display a warning screen confirming that the user really > > wanted to destroy the object. > > > > What justin is trying to do isn't possible in pure HTML. Let me > > explain quickly. > > > > A restful destroy action on a resource needs to be called using the > > DELETE http verb/method. Browsers don't support all the http verbs > > such as DELETE and UPDATE. Instead, merb cheats by doing a post and > > "stuff" the method to us in a parameter. > > > > The same way you cannot POST with a link, you can't DELETE with a > > link and that's why we have the delete_button helper which creates a > > form for you and send call the destroy action by using the DELETE > > http verb in a request made to the resource. > > OK, I actually cheat a little in the controller and have the delete > call the destroy method. I really didn't want the "are you sure" > prompt, so this seems to work fine from a link_to('delete', > resource(obj, :delete)) > > def destroy > if get_resource.destroy > redirect resource(controller_name.to_sym) > else > raise InternalServerError > end > end > > def delete(id) > destroy > end > > Have fun, > Roy > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
