Module: FatJam::ActsAsRevisable::Deletable
- Defined in:
- lib/acts_as_revisable/acts/deletable.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/acts_as_revisable/acts/deletable.rb', line 4 def self.included(base) base.instance_eval do alias_method_chain :destroy, :revisable end end |
Instance Method Details
#destroy_with_revisable ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/acts_as_revisable/acts/deletable.rb', line 10 def destroy_with_revisable now = Time.now prev = self.revisions.first self.revisable_deleted_at = now self.revisable_is_current = false self.revisable_current_at = if prev prev.update_attribute(:revisable_revised_at, now) prev.revisable_revised_at + 1.second else self.created_at end self.revisable_revised_at = self.revisable_deleted_at self.save(:without_revision => true) end |