Skip to content

Commit

Permalink
Add paranoia_destroy!
Browse files Browse the repository at this point in the history
  • Loading branch information
jhawthorn committed Nov 2, 2017
1 parent 87f8a0c commit 0f25822
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def paranoia_destroy
end
alias_method :destroy, :paranoia_destroy

def paranoia_destroy!
paranoia_destroy ||
raise(ActiveRecord::RecordNotDestroyed.new("Failed to destroy the record", self))
end

def paranoia_delete
raise ActiveRecord::ReadOnlyRecord, "#{self.class} is marked as readonly" if readonly?
if persisted?
Expand Down

0 comments on commit 0f25822

Please sign in to comment.