Skip to content
  • Henrik Nyh's avatar
    e87608e3
    Use safer 'destroy!' in controller scaffolds · e87608e3
    Henrik Nyh authored
    The old code does
    
        @foo.destroy
        redirect_to foo_url, notice: "Foo was successfully destroyed."
    
    which would incorrectly state the record was destroyed even if prevented
    by a `before_destroy` callback.
    
    The new version would raise.
    e87608e3
    Use safer 'destroy!' in controller scaffolds
    Henrik Nyh authored
    The old code does
    
        @foo.destroy
        redirect_to foo_url, notice: "Foo was successfully destroyed."
    
    which would incorrectly state the record was destroyed even if prevented
    by a `before_destroy` callback.
    
    The new version would raise.
Loading