mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Replace cattr_accessor with class_attribute.
This isolates subclasses' options properly.
This commit is contained in:
parent
3b0d2e2203
commit
e12d157e43
2 changed files with 9 additions and 6 deletions
|
@ -29,22 +29,22 @@ module PaperTrail
|
||||||
# The version this instance was reified from.
|
# The version this instance was reified from.
|
||||||
attr_accessor :version
|
attr_accessor :version
|
||||||
|
|
||||||
cattr_accessor :version_class_name
|
class_attribute :version_class_name
|
||||||
self.version_class_name = options[:class_name] || 'Version'
|
self.version_class_name = options[:class_name] || 'Version'
|
||||||
|
|
||||||
cattr_accessor :ignore
|
class_attribute :ignore
|
||||||
self.ignore = ([options[:ignore]].flatten.compact || []).map &:to_s
|
self.ignore = ([options[:ignore]].flatten.compact || []).map &:to_s
|
||||||
|
|
||||||
cattr_accessor :only
|
class_attribute :only
|
||||||
self.only = ([options[:only]].flatten.compact || []).map &:to_s
|
self.only = ([options[:only]].flatten.compact || []).map &:to_s
|
||||||
|
|
||||||
cattr_accessor :meta
|
class_attribute :meta
|
||||||
self.meta = options[:meta] || {}
|
self.meta = options[:meta] || {}
|
||||||
|
|
||||||
cattr_accessor :paper_trail_enabled_for_model
|
class_attribute :paper_trail_enabled_for_model
|
||||||
self.paper_trail_enabled_for_model = true
|
self.paper_trail_enabled_for_model = true
|
||||||
|
|
||||||
cattr_accessor :versions_association_name
|
class_attribute :versions_association_name
|
||||||
self.versions_association_name = options[:versions] || :versions
|
self.versions_association_name = options[:versions] || :versions
|
||||||
|
|
||||||
has_many self.versions_association_name,
|
has_many self.versions_association_name,
|
||||||
|
|
3
test/dummy/app/models/elephant.rb
Normal file
3
test/dummy/app/models/elephant.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Elephant < Animal
|
||||||
|
paper_trail_off
|
||||||
|
end
|
Loading…
Reference in a new issue