Sha256: fc1fce6a36f54dc01e18da56d36aadabc73e024124968d64091dde5add879fb5
Contents?: true
Size: 542 Bytes
Versions: 7
Compression:
Stored size: 542 Bytes
Contents
class Memento::Action::Destroy < Memento::Action::Base def fetch record.attributes_for_memento end def undo rebuild_object do |object| begin object.save! rescue object.id = nil object.save! end state.update_attribute(:record, object) end end private def rebuild_object new_object do |object| state.record_data.each do |attribute, value| object.send(:"#{attribute}=", value) end yield(object) if block_given? end end end
Version data entries
7 entries across 7 versions & 1 rubygems