2016-03-05 22:07:32 +00:00
|
|
|
require "active_support/core_ext/object" # provides the `try` method
|
2016-05-18 04:32:24 +00:00
|
|
|
require "paper_trail/attribute_serializers/legacy_active_record_shim"
|
|
|
|
require "paper_trail/attribute_serializers/object_attribute"
|
|
|
|
require "paper_trail/attribute_serializers/object_changes_attribute"
|
2016-02-23 22:59:14 +00:00
|
|
|
require "paper_trail/model_config"
|
|
|
|
require "paper_trail/record_trail"
|
2015-05-08 17:28:47 +00:00
|
|
|
|
2009-05-27 15:21:20 +00:00
|
|
|
module PaperTrail
|
2016-04-09 05:08:34 +00:00
|
|
|
# Extensions to `ActiveRecord::Base`. See `frameworks/active_record.rb`.
|
2016-02-23 22:59:14 +00:00
|
|
|
# It is our goal to have the smallest possible footprint here, because
|
|
|
|
# `ActiveRecord::Base` is a very crowded namespace! That is why we introduced
|
|
|
|
# `.paper_trail` and `#paper_trail`.
|
2010-03-19 17:21:16 +00:00
|
|
|
module Model
|
|
|
|
def self.included(base)
|
|
|
|
base.send :extend, ClassMethods
|
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
|
2016-04-09 05:08:34 +00:00
|
|
|
# :nodoc:
|
2010-03-19 17:21:16 +00:00
|
|
|
module ClassMethods
|
2015-08-03 20:45:42 +00:00
|
|
|
# Declare this in your model to track every create, update, and destroy.
|
|
|
|
# Each version of the model is available in the `versions` association.
|
2010-03-19 18:53:49 +00:00
|
|
|
#
|
2010-03-19 17:21:16 +00:00
|
|
|
# Options:
|
2015-08-03 20:45:42 +00:00
|
|
|
#
|
|
|
|
# - :on - The events to track (optional; defaults to all of them). Set
|
|
|
|
# to an array of `:create`, `:update`, `:destroy` as desired.
|
|
|
|
# - :class_name - The name of a custom Version class. This class should
|
|
|
|
# inherit from `PaperTrail::Version`.
|
|
|
|
# - :ignore - An array of attributes for which a new `Version` will not be
|
|
|
|
# created if only they change. It can also aceept a Hash as an
|
|
|
|
# argument where the key is the attribute to ignore (a `String` or
|
|
|
|
# `Symbol`), which will only be ignored if the value is a `Proc` which
|
|
|
|
# returns truthily.
|
|
|
|
# - :if, :unless - Procs that allow to specify conditions when to save
|
|
|
|
# versions for an object.
|
|
|
|
# - :only - Inverse of `ignore`. A new `Version` will be created only
|
|
|
|
# for these attributes if supplied it can also aceept a Hash as an
|
|
|
|
# argument where the key is the attribute to track (a `String` or
|
|
|
|
# `Symbol`), which will only be counted if the value is a `Proc` which
|
|
|
|
# returns truthily.
|
|
|
|
# - :skip - Fields to ignore completely. As with `ignore`, updates to
|
|
|
|
# these fields will not create a new `Version`. In addition, these
|
|
|
|
# fields will not be included in the serialized versions of the object
|
|
|
|
# whenever a new `Version` is created.
|
|
|
|
# - :meta - A hash of extra data to store. You must add a column to the
|
|
|
|
# `versions` table for each key. Values are objects or procs (which
|
|
|
|
# are called with `self`, i.e. the model with the paper trail). See
|
|
|
|
# `PaperTrail::Controller.info_for_paper_trail` for how to store data
|
|
|
|
# from the controller.
|
|
|
|
# - :versions - The name to use for the versions association. Default
|
|
|
|
# is `:versions`.
|
|
|
|
# - :version - The name to use for the method which returns the version
|
|
|
|
# the instance was reified from. Default is `:version`.
|
|
|
|
# - :save_changes - Whether or not to save changes to the object_changes
|
|
|
|
# column if it exists. Default is true
|
2016-04-05 09:37:24 +00:00
|
|
|
# - :join_tables - If the model has a has_and_belongs_to_many relation
|
|
|
|
# with an unpapertrailed model, passing the name of the association to
|
|
|
|
# the join_tables option will paper trail the join table but not save
|
|
|
|
# the other model, allowing reification of the association but with the
|
|
|
|
# other models latest state (if the other model is paper trailed, this
|
|
|
|
# option does nothing)
|
2015-03-23 12:10:35 +00:00
|
|
|
#
|
2016-04-21 05:16:28 +00:00
|
|
|
# @api public
|
2010-03-19 17:21:16 +00:00
|
|
|
def has_paper_trail(options = {})
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail.setup(options)
|
|
|
|
end
|
2011-07-18 15:07:46 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @api public
|
|
|
|
def paper_trail
|
|
|
|
::PaperTrail::ModelConfig.new(self)
|
|
|
|
end
|
2012-10-08 14:50:58 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @api private
|
|
|
|
def paper_trail_deprecate(new_method, old_method = nil)
|
|
|
|
old = old_method.nil? ? new_method : old_method
|
|
|
|
msg = format("Use paper_trail.%s instead of %s", new_method, old)
|
|
|
|
::ActiveSupport::Deprecation.warn(msg, caller(2))
|
|
|
|
end
|
2013-08-29 16:42:37 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def paper_trail_on_destroy(*args)
|
|
|
|
paper_trail_deprecate "on_destroy", "paper_trail_on_destroy"
|
|
|
|
paper_trail.on_destroy(*args)
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-09-23 15:45:45 +00:00
|
|
|
def paper_trail_on_update
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail_deprecate "on_update", "paper_trail_on_update"
|
|
|
|
paper_trail.on_update
|
2015-09-23 15:45:45 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-09-23 15:45:45 +00:00
|
|
|
def paper_trail_on_create
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail_deprecate "on_create", "paper_trail_on_create"
|
|
|
|
paper_trail.on_create
|
2015-09-23 15:45:45 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2014-02-12 23:27:10 +00:00
|
|
|
def paper_trail_off!
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail_deprecate "disable", "paper_trail_off!"
|
|
|
|
paper_trail.disable
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2014-02-12 23:27:10 +00:00
|
|
|
def paper_trail_on!
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail_deprecate "enable", "paper_trail_on!"
|
|
|
|
paper_trail.enable
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2012-11-06 23:15:31 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2014-02-11 21:01:44 +00:00
|
|
|
def paper_trail_enabled_for_model?
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail_deprecate "enabled?", "paper_trail_enabled_for_model?"
|
|
|
|
paper_trail.enabled?
|
2014-02-11 21:01:44 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2013-10-18 02:55:11 +00:00
|
|
|
def paper_trail_version_class
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail_deprecate "version_class", "paper_trail_version_class"
|
|
|
|
paper_trail.version_class
|
2013-10-18 02:55:11 +00:00
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
end
|
|
|
|
|
2010-04-06 16:27:15 +00:00
|
|
|
# Wrap the following methods in a module so we can include them only in the
|
|
|
|
# ActiveRecord models that declare `has_paper_trail`.
|
2010-03-19 17:21:16 +00:00
|
|
|
module InstanceMethods
|
2016-02-23 22:59:14 +00:00
|
|
|
def paper_trail
|
|
|
|
::PaperTrail::RecordTrail.new(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
# @deprecated
|
2010-10-21 11:30:50 +00:00
|
|
|
def live?
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "live?"
|
|
|
|
paper_trail.live?
|
2010-10-21 11:30:50 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-05-08 17:28:47 +00:00
|
|
|
def paper_trail_originator
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "originator", "paper_trail_originator"
|
|
|
|
paper_trail.originator
|
2010-06-28 13:03:35 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-05-08 17:28:47 +00:00
|
|
|
def originator
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "originator"
|
|
|
|
paper_trail.originator
|
2015-05-08 17:28:47 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2014-11-05 22:39:44 +00:00
|
|
|
def clear_rolled_back_versions
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "clear_rolled_back_versions"
|
|
|
|
paper_trail.clear_rolled_back_versions
|
2014-11-05 22:39:44 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def source_version
|
|
|
|
self.class.paper_trail_deprecate "source_version"
|
|
|
|
paper_trail.source_version
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def version_at(*args)
|
|
|
|
self.class.paper_trail_deprecate "version_at"
|
|
|
|
paper_trail.version_at(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
# @deprecated
|
2016-03-05 22:11:08 +00:00
|
|
|
def versions_between(start_time, end_time, _reify_options = {})
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "versions_between"
|
|
|
|
paper_trail.versions_between(start_time, end_time)
|
2012-03-08 20:51:43 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2010-06-22 13:41:26 +00:00
|
|
|
def previous_version
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "previous_version"
|
|
|
|
paper_trail.previous_version
|
|
|
|
end
|
|
|
|
|
|
|
|
# @deprecated
|
2010-06-22 13:41:26 +00:00
|
|
|
def next_version
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "next_version"
|
|
|
|
paper_trail.next_version
|
2010-06-22 13:41:26 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2014-02-20 16:40:52 +00:00
|
|
|
def paper_trail_enabled_for_model?
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "enabled_for_model?", "paper_trail_enabled_for_model?"
|
|
|
|
paper_trail.enabled_for_model?
|
|
|
|
end
|
2015-07-09 03:21:44 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def without_versioning(method = nil, &block)
|
|
|
|
self.class.paper_trail_deprecate "without_versioning"
|
|
|
|
paper_trail.without_versioning(method, &block)
|
2014-02-21 23:20:40 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def appear_as_new_record(&block)
|
|
|
|
self.class.paper_trail_deprecate "appear_as_new_record"
|
|
|
|
paper_trail.appear_as_new_record(&block)
|
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def whodunnit(value, &block)
|
|
|
|
self.class.paper_trail_deprecate "whodunnit"
|
|
|
|
paper_trail.whodunnit(value, &block)
|
2015-07-09 03:21:44 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
def touch_with_version(name = nil)
|
|
|
|
self.class.paper_trail_deprecate "touch_with_version"
|
|
|
|
paper_trail.touch_with_version(name)
|
2011-09-14 08:16:33 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# `record_create` is deprecated in favor of `paper_trail.record_create`,
|
|
|
|
# but does not yet print a deprecation warning. When the `after_create`
|
|
|
|
# callback is registered (by ModelConfig#on_create) we still refer to this
|
|
|
|
# method by name, e.g.
|
|
|
|
#
|
|
|
|
# @model_class.after_create :record_create, if: :save_version?
|
|
|
|
#
|
|
|
|
# instead of using the preferred method `paper_trail.record_create`, e.g.
|
|
|
|
#
|
|
|
|
# @model_class.after_create { |r| r.paper_trail.record_create if r.save_version?}
|
|
|
|
#
|
|
|
|
# We still register the callback by name so that, if someone calls
|
|
|
|
# `has_paper_trail` twice, the callback will *not* be registered twice.
|
|
|
|
# Our own test suite calls `has_paper_trail` many times for the same
|
|
|
|
# class.
|
|
|
|
#
|
|
|
|
# In the future, perhaps we should require that users only set up
|
|
|
|
# PT once per class.
|
|
|
|
#
|
|
|
|
# @deprecated
|
2010-10-28 10:14:19 +00:00
|
|
|
def record_create
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail.record_create
|
2010-10-28 10:14:19 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# See deprecation comment for `record_create`
|
|
|
|
# @deprecated
|
2015-03-18 21:40:24 +00:00
|
|
|
def record_update(force = nil)
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail.record_update(force)
|
|
|
|
end
|
|
|
|
|
|
|
|
# @deprecated
|
2015-11-28 04:08:02 +00:00
|
|
|
def pt_record_object_changes?
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "record_object_changes?", "pt_record_object_changes?"
|
|
|
|
paper_trail.record_object_changes?
|
2015-11-28 04:08:02 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-11-28 03:49:45 +00:00
|
|
|
def pt_recordable_object
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "recordable_object", "pt_recordable_object"
|
|
|
|
paper_trail.recordable_object
|
|
|
|
end
|
|
|
|
|
|
|
|
# @deprecated
|
2015-11-28 04:02:57 +00:00
|
|
|
def pt_recordable_object_changes
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "recordable_object_changes", "pt_recordable_object_changes"
|
|
|
|
paper_trail.recordable_object_changes
|
2015-11-28 04:02:57 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2012-11-05 19:09:06 +00:00
|
|
|
def changes_for_paper_trail
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "changes", "changes_for_paper_trail"
|
|
|
|
paper_trail.changes
|
2012-11-05 19:09:06 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# See deprecation comment for `record_create`
|
|
|
|
# @deprecated
|
2014-04-16 20:33:10 +00:00
|
|
|
def clear_version_instance!
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail.clear_version_instance
|
2014-04-16 16:44:21 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# See deprecation comment for `record_create`
|
|
|
|
# @deprecated
|
2014-04-16 20:33:10 +00:00
|
|
|
def reset_timestamp_attrs_for_update_if_needed!
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail.reset_timestamp_attrs_for_update_if_needed
|
2014-04-16 20:33:10 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# See deprecation comment for `record_create`
|
|
|
|
# @deprecated
|
2010-10-28 10:14:19 +00:00
|
|
|
def record_destroy
|
2016-02-23 22:59:14 +00:00
|
|
|
paper_trail.record_destroy
|
|
|
|
end
|
|
|
|
|
|
|
|
# @deprecated
|
2014-02-25 14:02:36 +00:00
|
|
|
def save_associations(version)
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "save_associations"
|
|
|
|
paper_trail.save_associations(version)
|
2016-04-05 09:37:24 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2016-04-05 09:37:24 +00:00
|
|
|
def save_associations_belongs_to(version)
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "save_associations_belongs_to"
|
|
|
|
paper_trail.save_associations_belongs_to(version)
|
2010-10-28 10:14:19 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2016-04-05 09:37:24 +00:00
|
|
|
def save_associations_has_and_belongs_to_many(version)
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate(
|
|
|
|
"save_associations_habtm",
|
|
|
|
"save_associations_has_and_belongs_to_many"
|
|
|
|
)
|
|
|
|
paper_trail.save_associations_habtm(version)
|
2016-04-05 09:37:24 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
# @api private
|
2014-02-25 14:02:36 +00:00
|
|
|
def reset_transaction_id
|
2016-02-23 22:59:14 +00:00
|
|
|
::ActiveSupport::Deprecation.warn(
|
|
|
|
"reset_transaction_id is deprecated, use PaperTrail.clear_transaction_id"
|
|
|
|
)
|
|
|
|
PaperTrail.clear_transaction_id
|
2014-02-25 14:02:36 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
|
|
|
# @api private
|
2010-03-19 17:21:16 +00:00
|
|
|
def merge_metadata(data)
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "merge_metadata"
|
|
|
|
paper_trail.merge_metadata(data)
|
2010-01-06 12:57:54 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-01-29 23:16:54 +00:00
|
|
|
def attributes_before_change
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "attributes_before_change"
|
|
|
|
paper_trail.attributes_before_change
|
2009-05-27 15:21:20 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
Maps enums to database values before storing in `object_changes`
Keep consistency between versions with regard to `changes` and
`object_changes` and how enum columns store their values.
Before, `changes` would map the changed attributes enum columns to the database
values (integer values). This allows reifying that version to maintain the
integrity of the enum. It did not do so for `object_changes` and thus, `0`
for non-json columns, and the enum value for json columns would be stored instead.
For the non-json columns, it mapped any non-integer enum value to `0` because
during serialization that column is an `integer`. Now this is fixed,
so that `object_changes` stores the enum mapped value.
Here is an example:
```ruby
class PostWithStatus < ActiveRecord::Base
has_paper_trail
enum status: { draft: 0, published: 1, archived: 2 }
end
post = PostWithStatus.new(status: :draft)
post.published!
version = post.versions.last
# Before
version.changeset #> { 'status' => ['draft', 'draft'] } (stored as [0, 0])
# After
version.changeset #> { 'status' => ['draft', 'published'] } (stored as [0, 1])
```
2016-03-11 09:18:40 +00:00
|
|
|
def object_attrs_for_paper_trail
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "object_attrs_for_paper_trail"
|
|
|
|
paper_trail.object_attrs_for_paper_trail
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2009-10-28 13:12:36 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2011-02-06 07:46:06 +00:00
|
|
|
def changed_notably?
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "changed_notably?"
|
|
|
|
paper_trail.changed_notably?
|
2011-02-06 07:46:06 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2015-07-16 01:28:07 +00:00
|
|
|
def ignored_attr_has_changed?
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "ignored_attr_has_changed?"
|
|
|
|
paper_trail.ignored_attr_has_changed?
|
2015-07-16 01:28:07 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2011-02-06 07:46:06 +00:00
|
|
|
def notably_changed
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "notably_changed"
|
|
|
|
paper_trail.notably_changed
|
2011-02-25 14:36:32 +00:00
|
|
|
end
|
2011-03-16 15:32:28 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2011-02-25 14:36:32 +00:00
|
|
|
def changed_and_not_ignored
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "changed_and_not_ignored"
|
|
|
|
paper_trail.changed_and_not_ignored
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2010-03-19 15:21:07 +00:00
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# The new method is named "enabled?" for consistency.
|
|
|
|
# @deprecated
|
2013-08-20 17:34:42 +00:00
|
|
|
def paper_trail_switched_on?
|
2016-02-23 22:59:14 +00:00
|
|
|
self.class.paper_trail_deprecate "enabled?", "paper_trail_switched_on?"
|
|
|
|
paper_trail.enabled?
|
2016-05-18 15:49:40 +00:00
|
|
|
end
|
|
|
|
|
2016-02-23 22:59:14 +00:00
|
|
|
# @deprecated
|
2016-04-05 01:35:09 +00:00
|
|
|
# @api private
|
2016-02-23 22:59:14 +00:00
|
|
|
def save_version?
|
|
|
|
self.class.paper_trail_deprecate "save_version?"
|
|
|
|
paper_trail.save_version?
|
2016-05-18 15:53:06 +00:00
|
|
|
end
|
2012-01-16 16:17:57 +00:00
|
|
|
end
|
2010-03-19 17:21:16 +00:00
|
|
|
end
|
2009-05-27 15:21:20 +00:00
|
|
|
end
|