#156 √ resolved
oleg dashevskii

delete_button is gone

Reported by oleg dashevskii | September 1st, 2008 @ 10:04 PM | in 0.9.6

Commit 3c57a179 ("Merged helpers_refactor branch into master") dumped the delete_button helper. Specs are commented out for now.

But merb_datamapper's current resource generator still generates calls to it.

Which one should be fixed? :)

Comments and changes to this ticket

  • Michael Klishin (antares)

    Michael Klishin (antares) September 2nd, 2008 @ 12:08 AM

    • → Milestone changed from “” to “0.9.6”
    • → State changed from “new” to “open”
    • → Assigned user changed from “” to “GMFlash”
  • Bryan Ray

    Bryan Ray September 2nd, 2008 @ 05:40 AM

    I'd say merb_datamapper should be updated. Unless we have plans to put the delete_button method back in?

  • oleg dashevskii

    oleg dashevskii September 2nd, 2008 @ 08:21 AM

    So, what's the proper way to reimplement this behaviour using available helpers? I'd fix the merb_datamapper.

  • GMFlash

    GMFlash September 6th, 2008 @ 03:53 AM

    delete_button generated an entire form. Since it is invalid html to have a form inside of another form I don't think delete_button should be resurrected. The solution I currently use is:

    
    # In my view
    <%= submit "Update" %>
    <%= submit "Cancel", :name => "submit[cancel]" %>
    <%= submit "Delete", :name => "submit[destroy]" %>
    
    
    # In my controller
    before :determine_submit_type, :only => [:create, :update, :destroy]
    
    def destroy
      @document = Document.find(params[:id])
      @document.destroy
      redirect url(:documents)
    end
    
    private
    
    def determine_submit_type
      submit = params[:submit] || return
      case
      when submit[:cancel]
        redirect url(:documents)
      when submit[:destroy]
        destroy
      end
    end
    
  • GMFlash

    GMFlash September 6th, 2008 @ 03:50 AM

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

    Jack Dempsey says this is fixed in merb_datamapper.

  • vo.x

    vo.x October 14th, 2008 @ 08:20 PM

    Interesting, delete_button is back. What is the difference?

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 »

Shared Ticket Bins