durran-mongoid 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
@@ -23,8 +23,12 @@ module Mongoid #:nodoc:
|
|
23
23
|
# Builds a new Document and adds it to the association collection. The
|
24
24
|
# document created will be of the same class as the others in the
|
25
25
|
# association, and the attributes will be passed into the constructor.
|
26
|
+
#
|
27
|
+
# Returns the newly created object.
|
26
28
|
def build(attributes)
|
27
|
-
|
29
|
+
object = @klass.new(attributes)
|
30
|
+
push(object)
|
31
|
+
object
|
28
32
|
end
|
29
33
|
|
30
34
|
end
|
data/mongoid.gemspec
CHANGED
@@ -60,6 +60,12 @@ describe Mongoid::Associations::HasManyAssociation do
|
|
60
60
|
@association[2].street.should == "Street 1"
|
61
61
|
end
|
62
62
|
|
63
|
+
it "returns the newly built object in the association" do
|
64
|
+
address = @association.build({ :street => "Yet Another", :document_class => "Address" })
|
65
|
+
address.should be_a_kind_of(Address)
|
66
|
+
address.street.should == "Yet Another"
|
67
|
+
end
|
68
|
+
|
63
69
|
end
|
64
70
|
|
65
71
|
describe "#first" do
|