Skip to content

Commit

Permalink
fix rails 3.1 deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Sonnek committed Aug 29, 2011
1 parent 81c49cd commit 217cc81
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions lib/acts_as_stripped.rb
@@ -1,23 +1,15 @@
module ActsAsStripped module ActsAsStripped
def self.included(base)
base.extend(ClassMethods)
end

module ClassMethods module ClassMethods
def acts_as_stripped(*attrs) def acts_as_stripped(*attrs)
class_inheritable_accessor :acts_as_stripped_attributes class_attribute :acts_as_stripped_attributes
self.acts_as_stripped_attributes = attrs if attrs.any? self.acts_as_stripped_attributes = attrs


before_validation :strip_fields before_validation :strip_fields


include ActsAsStripped::InstanceMethods include ActsAsStripped::InstanceMethods
extend ActsAsStripped::SingletonMethods
end end
end end


module SingletonMethods
end

module InstanceMethods module InstanceMethods
private private
def strip_fields def strip_fields
Expand All @@ -28,6 +20,4 @@ def strip_fields
end end
end end


if Object.const_defined?("ActiveRecord") ActiveRecord::Base.extend(ActsAsStripped::ClassMethods)
ActiveRecord::Base.send(:include, ActsAsStripped)
end

0 comments on commit 217cc81

Please sign in to comment.