Class: Memento::Action::Destroy
- Defined in:
- lib/memento/action/destroy.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#fetch?, inherited, #initialize, #record, #record_data
Constructor Details
This class inherits a constructor from Memento::Action::Base
Instance Method Details
#fetch ⇒ Object
4 5 6 |
# File 'lib/memento/action/destroy.rb', line 4 def fetch record.attributes_for_memento end |
#undo ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/memento/action/destroy.rb', line 8 def undo rebuild_object do |object| begin object.save! rescue object.id = nil object.save! end state.record = object state.save end end |