Module PaperTrail::VersionConcern
In: lib/paper_trail/version_concern.rb

Methods

Classes and Modules

Module PaperTrail::VersionConcern::ClassMethods

Public Instance methods

Returns what changed in this version of the item. `ActiveModel::Dirty#changes`. returns `nil` if your `versions` table does not have an `object_changes` text column.

Returns an integer representing the chronological position of the version among its siblings (see `sibling_versions`). The "create" event, for example, has an index of 0. @api public

Returns who put the item into the state stored in this version.

Restore the item from this version.

Optionally this can also restore all :has_one and :has_many (including has_many :through) associations as they were "at the time", if they are also being versioned by PaperTrail.

Options:

  • :has_one
    • `true` - Also reify has_one associations.
    • `false - Default.
  • :has_many
    • `true` - Also reify has_many and has_many :through associations.
    • `false` - Default.
  • :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.

Returns who changed the item from the state it had in this version. This is an alias for `whodunnit`.

version_author()

Alias for terminator

[Validate]