couchrest_model 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/couchrest_model.gemspec +1 -1
- data/history.md +6 -0
- data/lib/couchrest/model/embeddable.rb +12 -9
- data/spec/unit/embeddable_spec.rb +11 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/couchrest_model.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
24
|
s.require_paths = ["lib"]
|
25
25
|
|
26
|
-
s.add_dependency(%q<couchrest>, "1.1.
|
26
|
+
s.add_dependency(%q<couchrest>, "1.1.1")
|
27
27
|
s.add_dependency(%q<mime-types>, "~> 1.15")
|
28
28
|
s.add_dependency(%q<activemodel>, "~> 3.0")
|
29
29
|
s.add_dependency(%q<tzinfo>, "~> 0.3.22")
|
data/history.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CouchRest Model Change History
|
2
2
|
|
3
|
+
## 1.1.1 - 2011-07-04
|
4
|
+
|
5
|
+
* Minor fix
|
6
|
+
* Bumping CouchRest version dependency for important initialize method fix.
|
7
|
+
* Ensuring super on Embeddable#initialize can be called.
|
8
|
+
|
3
9
|
## 1.1.0 - 2011-06-25
|
4
10
|
|
5
11
|
* Major Alterations
|
@@ -2,8 +2,10 @@ module CouchRest::Model
|
|
2
2
|
module Embeddable
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
# Include Attributes early to ensure super() will work
|
6
|
+
include CouchRest::Attributes
|
7
|
+
|
5
8
|
included do
|
6
|
-
include CouchRest::Attributes
|
7
9
|
include CouchRest::Model::Configuration
|
8
10
|
include CouchRest::Model::Properties
|
9
11
|
include CouchRest::Model::PropertyProtection
|
@@ -20,17 +22,18 @@ module CouchRest::Model
|
|
20
22
|
false # Can never be base doc!
|
21
23
|
end
|
22
24
|
|
23
|
-
# Initialize a new Casted Model. Accepts the same
|
24
|
-
# options as CouchRest::Model::Base for preparing and initializing
|
25
|
-
# attributes.
|
26
|
-
def initialize(keys = {}, options = {})
|
27
|
-
super()
|
28
|
-
prepare_all_attributes(keys, options)
|
29
|
-
run_callbacks(:initialize) { self }
|
30
|
-
end
|
31
25
|
end
|
32
26
|
end
|
33
27
|
|
28
|
+
# Initialize a new Casted Model. Accepts the same
|
29
|
+
# options as CouchRest::Model::Base for preparing and initializing
|
30
|
+
# attributes.
|
31
|
+
def initialize(keys = {}, options = {})
|
32
|
+
super()
|
33
|
+
prepare_all_attributes(keys, options)
|
34
|
+
run_callbacks(:initialize) { self }
|
35
|
+
end
|
36
|
+
|
34
37
|
# False if the casted model has already
|
35
38
|
# been saved in the containing document
|
36
39
|
def new?
|
@@ -79,6 +79,17 @@ describe CouchRest::Model::Embeddable do
|
|
79
79
|
@obj = klass.new
|
80
80
|
@obj.name.should eql("foobar")
|
81
81
|
end
|
82
|
+
it "should allow override of initialize with super" do
|
83
|
+
klass = Class.new do
|
84
|
+
include CouchRest::Model::Embeddable
|
85
|
+
after_initialize :set_name
|
86
|
+
property :name
|
87
|
+
def set_name; self.name = "foobar"; end
|
88
|
+
def initialize(attrs = {}); super(); end
|
89
|
+
end
|
90
|
+
@obj = klass.new
|
91
|
+
@obj.name.should eql("foobar")
|
92
|
+
end
|
82
93
|
end
|
83
94
|
|
84
95
|
describe "casted as an attribute, but without a value" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: couchrest_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- J. Chris Anderson
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - "="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.1.
|
28
|
+
version: 1.1.1
|
29
29
|
type: :runtime
|
30
30
|
version_requirements: *id001
|
31
31
|
- !ruby/object:Gem::Dependency
|