Permalink
Browse files

fix rails 3.1 deprecation warnings

  • Loading branch information...
1 parent 81c49cd commit 217cc81b61d403c8741c822b4f0d848e72968b47 Ryan Sonnek committed Aug 29, 2011
Showing with 3 additions and 13 deletions.
  1. +3 −13 lib/acts_as_stripped.rb
View
16 lib/acts_as_stripped.rb
@@ -1,23 +1,15 @@
module ActsAsStripped
- def self.included(base)
- base.extend(ClassMethods)
- end
-
module ClassMethods
def acts_as_stripped(*attrs)
- class_inheritable_accessor :acts_as_stripped_attributes
- self.acts_as_stripped_attributes = attrs if attrs.any?
+ class_attribute :acts_as_stripped_attributes
+ self.acts_as_stripped_attributes = attrs
before_validation :strip_fields
include ActsAsStripped::InstanceMethods
- extend ActsAsStripped::SingletonMethods
end
end
- module SingletonMethods
- end
-
module InstanceMethods
private
def strip_fields
@@ -28,6 +20,4 @@ def strip_fields
end
end
-if Object.const_defined?("ActiveRecord")
- ActiveRecord::Base.send(:include, ActsAsStripped)
-end
+ActiveRecord::Base.extend(ActsAsStripped::ClassMethods)

0 comments on commit 217cc81

Please sign in to comment.