Fix Embeddable and super issues. Prep for release 1.1.1
This commit is contained in:
parent
8efa5208da
commit
9d724aee47
|
@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
||||||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|
||||||
s.add_dependency(%q<couchrest>, "1.1.0")
|
s.add_dependency(%q<couchrest>, "1.1.1")
|
||||||
s.add_dependency(%q<mime-types>, "~> 1.15")
|
s.add_dependency(%q<mime-types>, "~> 1.15")
|
||||||
s.add_dependency(%q<activemodel>, "~> 3.0")
|
s.add_dependency(%q<activemodel>, "~> 3.0")
|
||||||
s.add_dependency(%q<tzinfo>, "~> 0.3.22")
|
s.add_dependency(%q<tzinfo>, "~> 0.3.22")
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# CouchRest Model Change History
|
# CouchRest Model Change History
|
||||||
|
|
||||||
|
## 1.1.1 - 2011-07-04
|
||||||
|
|
||||||
|
* Minor fix
|
||||||
|
* Bumping CouchRest version dependency for important initialize method fix.
|
||||||
|
* Ensuring super on Embeddable#initialize can be called.
|
||||||
|
|
||||||
## 1.1.0 - 2011-06-25
|
## 1.1.0 - 2011-06-25
|
||||||
|
|
||||||
* Major Alterations
|
* Major Alterations
|
||||||
|
|
|
@ -2,8 +2,10 @@ module CouchRest::Model
|
||||||
module Embeddable
|
module Embeddable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
# Include Attributes early to ensure super() will work
|
||||||
include CouchRest::Attributes
|
include CouchRest::Attributes
|
||||||
|
|
||||||
|
included do
|
||||||
include CouchRest::Model::Configuration
|
include CouchRest::Model::Configuration
|
||||||
include CouchRest::Model::Properties
|
include CouchRest::Model::Properties
|
||||||
include CouchRest::Model::PropertyProtection
|
include CouchRest::Model::PropertyProtection
|
||||||
|
@ -20,6 +22,9 @@ module CouchRest::Model
|
||||||
false # Can never be base doc!
|
false # Can never be base doc!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Initialize a new Casted Model. Accepts the same
|
# Initialize a new Casted Model. Accepts the same
|
||||||
# options as CouchRest::Model::Base for preparing and initializing
|
# options as CouchRest::Model::Base for preparing and initializing
|
||||||
# attributes.
|
# attributes.
|
||||||
|
@ -28,8 +33,6 @@ module CouchRest::Model
|
||||||
prepare_all_attributes(keys, options)
|
prepare_all_attributes(keys, options)
|
||||||
run_callbacks(:initialize) { self }
|
run_callbacks(:initialize) { self }
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# False if the casted model has already
|
# False if the casted model has already
|
||||||
# been saved in the containing document
|
# been saved in the containing document
|
||||||
|
|
|
@ -79,6 +79,17 @@ describe CouchRest::Model::Embeddable do
|
||||||
@obj = klass.new
|
@obj = klass.new
|
||||||
@obj.name.should eql("foobar")
|
@obj.name.should eql("foobar")
|
||||||
end
|
end
|
||||||
|
it "should allow override of initialize with super" do
|
||||||
|
klass = Class.new do
|
||||||
|
include CouchRest::Model::Embeddable
|
||||||
|
after_initialize :set_name
|
||||||
|
property :name
|
||||||
|
def set_name; self.name = "foobar"; end
|
||||||
|
def initialize(attrs = {}); super(); end
|
||||||
|
end
|
||||||
|
@obj = klass.new
|
||||||
|
@obj.name.should eql("foobar")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "casted as an attribute, but without a value" do
|
describe "casted as an attribute, but without a value" do
|
||||||
|
|
Loading…
Reference in a new issue