#26 √ resolved
Shay Arnett

[PATCH] Add a delete action to restful routes

Reported by Shay Arnett | February 11th, 2008 @ 10:34 PM

Originally posted on Trac by steve.tooke@gmail.com

Original Trac Ticket

Description

Based on this: http://www.thelucid.com/articles...

The patch adds a GET to /posts/1/delete which will allow non-javascript confirm destroy before calling the DELETE to destroy.

Still need to add to the generators to have them create the action / templates / specs as expected.

Trac Attachments

http://merb.devjavu.com/attachme...

http://merb.devjavu.com/attachme...

Trac Comments

11/28/07 01:13:37 changed by steve.tooke@gmail.com


  11/28/07 01:13:37 changed by steve.tooke@gmail.com

    attachment restful-delete.diff added.

    attachment restful-delete.diff added.
    
   

11/28/07 05:39:32 changed by me@inviz.ru


yeah, and what if i  on your site? it should be POST atleast

11/28/07 07:05:41 changed by steve.tooke@gmail.com


Replying to me@inviz.ru:

 yeah, and what if i  on your site? it should be POST atleast

The idea here isn't that this will actually perform the delete, but it will give you a form to confirm the delete. In the same way that 'new' gives you a form to POST to 'create', 'edit' a form to PUT to 'update'. It can perhaps be named better than delete.

Take a look at the blog post above.

12/13/07 02:03:23 changed by luke.sutton@gmail.com


I like this approach. I've used it successfully in a few rails apps. I think it makes sense as a default.

01/07/08 08:40:04 changed by steve.tooke@gmail.com


updated patch for changes to trunk

  01/07/08 08:40:04 changed by steve.tooke@gmail.com

    attachment restful_delete.diff added.

updated patch for changes to trunk

    attachment restful_delete.diff added.
    
   

01/09/08 23:48:22 changed by davidlee@berkeley.edu


Nice!

I've seen this suggested elsewhere on the web.
Too bad rails didn't like this approach.

I'm glad it's going to be in merb, though!

Comments and changes to this ticket

  • Michael D. Ivey (ivey)

    Michael D. Ivey (ivey) February 12th, 2008 @ 01:38 AM

    • → State changed from “new” to “open”
    • → Assigned user changed from “” to “Michael D. Ivey (ivey)”
  • Steve Tooke (tooky)

    Steve Tooke (tooky) February 12th, 2008 @ 11:35 AM

    I've started re-implementing this for merb-core, as well as copying across some of the resource routes specs from 0.5.x

    Please pull:

    git pull git://gitorious.org/merb-core/mainline.git restful_delete

    or see here: http://gitorious.org/projects/me...

  • Michael D. Ivey (ivey)

    Michael D. Ivey (ivey) February 12th, 2008 @ 07:01 PM

    [09:57:46] ivey: i'm thinking it might be good to have a default template for that action ... what do you think?

    [09:59:03] tooky: ivey: I was going to look at that next actually - just looking over merb-gen to get a handle on it

    [09:59:46] ivey: i was thinking either an app-wide one, or even a merb-wide one

    [10:00:00] ivey: in lots of cases, it will be the same little form

    [10:01:05] tooky: that's neat idea - its just going to be an "are you sure?" form

    [10:17:45] tooky: ivey: i guess what we want is if we're rendering the delete action and the user hasn't created a template we use the default?

  • Steve Tooke (tooky)

    Steve Tooke (tooky) February 12th, 2008 @ 11:42 PM

    I don't think we can have a default template without adding some clunky options to render, and even then its not likely to work for all cases. I'll open a ticket for merb-gen and put something together.

  • Michael D. Ivey (ivey)

    Michael D. Ivey (ivey) February 13th, 2008 @ 06:42 AM

    • → State changed from “open” to “resolved”

    Merged. Thanks tooky

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

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

People watching this ticket

Tags