josevalim/inherited_resources — Issue #185: Destroy reports success when the action fails
Author: derekprior
Created: 2011-12-07 20:54:33+00:00
State: open

The output from the call to `object.destroy` is cast aside when determining whether to respond with success or failure. It seems that the only thing driving this decision is `object.errors.empty?` (see https://github.com/josevalim/inherited_resources/blob/master/lib/inherited_resources/base_helpers.rb#L252).

Destroy can fail while errors is non-empty. For instance, a `before_destroy` callback may return `false`. In this case, inherited resources will think the call succeeded because errors is empty.

Shouldn't `respond_with_dual_blocks` also take into consideration the return value from `destroy` (or any operation, really)? Or is it simply poor style to ever fail a delete/write operation without adding to `object.errors`?