Permalink
Browse files

Cleared deprecation warning: "class_inheritable_attribute is deprecat…

…ed, please use class_attribute method instead"

Signed-off-by: Marc Love <marcslove@gmail.com>
  • Loading branch information...
1 parent 04b4ba9 commit bebdeca9b0c5241526765a2602dbf9e142b3af1a @marclove marclove committed Apr 22, 2011
@@ -3,18 +3,22 @@ module Plugins
module Accessible
extend ActiveSupport::Concern
+ included do
+ class_attribute :_attr_accessible
+ end
+
module ClassMethods
def attr_accessible(*attrs)
raise AccessibleOrProtected.new(name) if try(:protected_attributes?)
- self.write_inheritable_attribute(:attr_accessible, Set.new(attrs) + (accessible_attributes || []))
+ self._attr_accessible = Set.new(attrs) + (accessible_attributes || [])
end
def accessible_attributes?
!accessible_attributes.nil?
end
def accessible_attributes
- self.read_inheritable_attribute(:attr_accessible)
+ self._attr_accessible
end
end
@@ -6,14 +6,18 @@ module Plugins
module Protected
extend ActiveSupport::Concern
+ included do
+ class_attribute :_attr_protected
+ end
+
module ClassMethods
def attr_protected(*attrs)
raise AccessibleOrProtected.new(name) if try(:accessible_attributes?)
- self.write_inheritable_attribute(:attr_protected, Set.new(attrs) + (protected_attributes || []))
+ self._attr_protected = Set.new(attrs) + (protected_attributes || [])
end
def protected_attributes
- self.read_inheritable_attribute(:attr_protected)
+ self._attr_protected
end
def protected_attributes?
@@ -4,6 +4,10 @@ module Plugins
module Scopes
extend ActiveSupport::Concern
+ included do
+ class_attribute :_scopes
+ end
+
module ClassMethods
def scope(name, scope_options={})
scopes[name] = lambda do |*args|
@@ -15,7 +19,7 @@ def scope(name, scope_options={})
end
def scopes
- read_inheritable_attribute(:scopes) || write_inheritable_attribute(:scopes, {})
+ self._scopes || self._scopes = {}
end
end
end

0 comments on commit bebdeca

Please sign in to comment.