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.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<activemodel>, "~> 3.0")
|
||||
s.add_dependency(%q<tzinfo>, "~> 0.3.22")
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# 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
|
||||
|
||||
* Major Alterations
|
||||
|
|
|
@ -2,8 +2,10 @@ module CouchRest::Model
|
|||
module Embeddable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
# Include Attributes early to ensure super() will work
|
||||
include CouchRest::Attributes
|
||||
|
||||
included do
|
||||
include CouchRest::Model::Configuration
|
||||
include CouchRest::Model::Properties
|
||||
include CouchRest::Model::PropertyProtection
|
||||
|
@ -20,6 +22,9 @@ module CouchRest::Model
|
|||
false # Can never be base doc!
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# Initialize a new Casted Model. Accepts the same
|
||||
# options as CouchRest::Model::Base for preparing and initializing
|
||||
# attributes.
|
||||
|
@ -28,8 +33,6 @@ module CouchRest::Model
|
|||
prepare_all_attributes(keys, options)
|
||||
run_callbacks(:initialize) { self }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# False if the casted model has already
|
||||
# been saved in the containing document
|
||||
|
|
|
@ -79,6 +79,17 @@ describe CouchRest::Model::Embeddable do
|
|||
@obj = klass.new
|
||||
@obj.name.should eql("foobar")
|
||||
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
|
||||
|
||||
describe "casted as an attribute, but without a value" do
|
||||
|
|
Loading…
Reference in a new issue