Commit 512654f3 by Ryan Bigg

Merge pull request #7 from tonybyrne/master

Preserve ActiveRecord semantics / Don't require models to be valid before destroy or delete.
parents 14d131a1 8f14cd7e
...@@ -10,7 +10,10 @@ module Paranoia ...@@ -10,7 +10,10 @@ module Paranoia
def destroy def destroy
_run_destroy_callbacks _run_destroy_callbacks
self[:deleted_at] ||= Time.now self[:deleted_at] ||= Time.now
self.save # If the instance has already been persisted, then we need to re-save it to flag it as
# destroyed / deleted. We don't require validation in case it causes the updated to fail.
save(:validate => false) if persisted?
freeze
end end
alias :delete :destroy alias :delete :destroy
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment