lib/paper_trail/record_trail.rb
# Given a `value` from the model's `meta` option, returns an object to be
# persisted. The `value` can be a simple scalar value, but it can also
# be a symbol that names a model method, or even a Proc.
# @api private
Given a `value` from the model's `meta` option, returns an object to be
persisted. The `value` can be a simple scalar value, but it can also
be a symbol that names a model method, or even a Proc.
Given a ` value ` from the model ' s ` meta ` option returns an object to be persisted . The ` value ` can be a simple scalar value but it can also be a symbol that names a model method or even a Proc .
def model_metadatum(value, event)
      if value.respond_to?(:call)
        value.call(@record)
      elsif value.is_a?(Symbol) && @record.respond_to?(value, true)
        if event != "create" &&
            @record.has_attribute?(value) &&
            attribute_changed_in_latest_version?(value)
          attribute_in_previous_version(value, false)
        else
          @record.send(value)
        end
      else
        value
      end
    end
def model_metadatum ( value , event ) if value . respond_to? ( :call ) value . call ( @record ) elsif value . is_a? ( Symbol ) && @record . respond_to? ( value , true ) if event != "create" && @record . has_attribute? ( value ) && attribute_changed_in_latest_version? ( value ) attribute_in_previous_version ( value , false ) else @record . send ( value ) end else value end end
Given a `value` from the model's `meta` option, returns an object to be
persisted.
Given a ` value ` from the model ' s ` meta ` option returns an object to be persisted .
# If it is an attribute that is changing in an existing object, # be sure to grab the current version.
value
<not_specific>
event
<not_specific>
api
None