Class: Memento::Action::Update
- Inherits:
-
Base
- Object
- Base
- Memento::Action::Update
show all
- Defined in:
- lib/memento/action/update.rb
Instance Attribute Summary
Attributes inherited from Base
#state
Instance Method Summary
collapse
Methods inherited from Base
inherited, #initialize, #record, #record_data
Instance Method Details
#fetch ⇒ Object
4
5
6
|
# File 'lib/memento/action/update.rb', line 4
def fetch
record.changes_for_memento
end
|
#fetch? ⇒ Boolean
8
9
10
|
# File 'lib/memento/action/update.rb', line 8
def fetch?
record.changes_for_memento.any?
end
|
#undo ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/memento/action/update.rb', line 12
def undo
if !record
was_destroyed
elsif mergable?
update_record
else
was_changed
end
end
|