Merge pull request #70 from pezra/rails-3.1

Rails 3.1 support
This commit is contained in:
Sam Lown 2011-05-10 10:04:56 -07:00
commit 1309fa7082
3 changed files with 4 additions and 18 deletions

View file

@ -25,9 +25,9 @@ Gem::Specification.new do |s|
s.add_dependency(%q<couchrest>, "1.1.0.pre2")
s.add_dependency(%q<mime-types>, "~> 1.15")
s.add_dependency(%q<activemodel>, "~> 3.0.0")
s.add_dependency(%q<activemodel>, "~> 3.0")
s.add_dependency(%q<tzinfo>, "~> 0.3.22")
s.add_dependency(%q<railties>, "~> 3.0.0")
s.add_dependency(%q<railties>, "~> 3.0")
s.add_development_dependency(%q<rspec>, ">= 2.0.0")
s.add_development_dependency(%q<rack-test>, ">= 0.5.7")
# s.add_development_dependency("jruby-openssl", ">= 0.7.3")

View file

@ -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
#

View file

@ -1,7 +1,6 @@
require 'active_model'
require "active_model/callbacks"
require "active_model/conversion"
require "active_model/deprecated_error_methods"
require "active_model/errors"
require "active_model/naming"
require "active_model/serialization"