From e12d157e431e7145eeab91c8a94acb0d5b017697 Mon Sep 17 00:00:00 2001 From: Edward Tsech Date: Wed, 31 Aug 2011 10:15:32 +0200 Subject: [PATCH] Replace cattr_accessor with class_attribute. This isolates subclasses' options properly. --- lib/paper_trail/has_paper_trail.rb | 12 ++++++------ test/dummy/app/models/elephant.rb | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 test/dummy/app/models/elephant.rb diff --git a/lib/paper_trail/has_paper_trail.rb b/lib/paper_trail/has_paper_trail.rb index 8b6a92f1..6f67d3ce 100644 --- a/lib/paper_trail/has_paper_trail.rb +++ b/lib/paper_trail/has_paper_trail.rb @@ -29,22 +29,22 @@ module PaperTrail # The version this instance was reified from. attr_accessor :version - cattr_accessor :version_class_name + class_attribute :version_class_name self.version_class_name = options[:class_name] || 'Version' - cattr_accessor :ignore + class_attribute :ignore self.ignore = ([options[:ignore]].flatten.compact || []).map &:to_s - cattr_accessor :only + class_attribute :only self.only = ([options[:only]].flatten.compact || []).map &:to_s - cattr_accessor :meta + class_attribute :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 - cattr_accessor :versions_association_name + class_attribute :versions_association_name self.versions_association_name = options[:versions] || :versions has_many self.versions_association_name, diff --git a/test/dummy/app/models/elephant.rb b/test/dummy/app/models/elephant.rb new file mode 100644 index 00000000..e5d3d70b --- /dev/null +++ b/test/dummy/app/models/elephant.rb @@ -0,0 +1,3 @@ +class Elephant < Animal + paper_trail_off +end