Deprecate PaperTrail.serialized_attributes?

This is a follow-up to PR 667
"Use Active Record's type system from 4.2 onwards."
This commit is contained in:
Jared Beck 2015-12-22 11:32:50 -05:00
parent 6df3532b7f
commit 6a91c73d46
2 changed files with 10 additions and 8 deletions

View File

@ -24,11 +24,12 @@ module PaperTrail
!!PaperTrail.config.enabled
end
# ActiveRecord 5 drops support for serialized attributes; for previous
# versions of ActiveRecord it is supported, we have a config option
# to enable it within PaperTrail.
def self.serialized_attributes?
!!PaperTrail.config.serialized_attributes && ::ActiveRecord::VERSION::MAJOR < 5
ActiveSupport::Deprecation.warn(
"PaperTrail.serialized_attributes? is deprecated without replacement " +
"and always returns false."
)
false
end
# Sets whether PaperTrail is enabled or disabled for the current request.

View File

@ -14,15 +14,16 @@ module PaperTrail
def serialized_attributes
ActiveSupport::Deprecation.warn(
"PaperTrail.config.serialized_attributes is deprecated without " \
"replacement and no longer has any effect."
"PaperTrail.config.serialized_attributes is deprecated without " +
"replacement and always returns false."
)
false
end
def serialized_attributes=(_)
ActiveSupport::Deprecation.warn(
"PaperTrail.config.serialized_attributes= is deprecated without " \
"replacement and no longer has any effect."
"PaperTrail.config.serialized_attributes= is deprecated without " +
"replacement and no longer has any effect."
)
end