Use class_attribute rather than extlib_inheritable_attribute (which is removed in rails 3.1)
This commit is contained in:
parent
2b0dc2b779
commit
2669de9511
1 changed files with 2 additions and 15 deletions
|
@ -5,26 +5,13 @@ module CouchRest
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
extlib_inheritable_accessor(:properties) unless self.respond_to?(:properties)
|
||||
extlib_inheritable_accessor(:properties_by_name) unless self.respond_to?(:properties_by_name)
|
||||
class_attribute(:properties) unless self.respond_to?(:properties)
|
||||
class_attribute(:properties_by_name) unless self.respond_to?(:properties_by_name)
|
||||
self.properties ||= []
|
||||
self.properties_by_name ||= {}
|
||||
raise "You can only mixin Properties in a class responding to [] and []=, if you tried to mixin CastedModel, make sure your class inherits from Hash or responds to the proper methods" unless (method_defined?(:[]) && method_defined?(:[]=))
|
||||
end
|
||||
|
||||
# Returns the Class properties
|
||||
#
|
||||
# ==== Returns
|
||||
# Array:: the list of properties for model's class
|
||||
def properties
|
||||
self.class.properties
|
||||
end
|
||||
|
||||
# Returns all the class's properties as a Hash where the key is the name
|
||||
# of the property.
|
||||
def properties_by_name
|
||||
self.class.properties_by_name
|
||||
end
|
||||
|
||||
# Returns the Class properties with their values
|
||||
#
|
||||
|
|
Loading…
Reference in a new issue