Method: PaperTrail::VersionConcern#reify

Defined in:
lib/mongo_trails/version_concern.rb

#reify(options = {}) ⇒ Object

Restore the item from this version.

Options:

  • :mark_for_destruction

    • ‘true` - Mark the has_one/has_many associations that did not exist in the reified version for destruction, instead of removing them.

    • ‘false` - Default. Useful for persisting the reified version.

  • :dup

    • ‘false` - Default.

    • ‘true` - Always create a new object instance. Useful for comparing two versions of the same object.

  • :unversioned_attributes

    • ‘:nil` - Default. Attributes undefined in version record are set to nil in reified record.

    • ‘:preserve` - Attributes undefined in version record are not modified.



208
209
210
211
212
213
214
# File 'lib/mongo_trails/version_concern.rb', line 208

def reify(options = {})
  unless self.class.fields.keys.include? "object"
    raise "reify can't be called without an object column"
  end
  return nil if object.nil?
  ::PaperTrail::Reifier.reify(self, options)
end