mongoid 0.10.0 → 0.10.1
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 +1 -1
- data/lib/mongoid/associations/belongs_to_related.rb +2 -2
- data/lib/mongoid/associations/has_many.rb +1 -2
- data/lib/mongoid/associations/has_many_related.rb +1 -1
- data/lib/mongoid/associations/has_one.rb +1 -1
- data/lib/mongoid/associations/has_one_related.rb +1 -1
- data/mongoid.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.1
|
@@ -2,9 +2,9 @@
|
|
2
2
|
module Mongoid #:nodoc:
|
3
3
|
module Associations #:nodoc:
|
4
4
|
class BelongsToRelated #:nodoc:
|
5
|
+
include Proxy
|
5
6
|
|
6
|
-
|
7
|
-
attr_reader :document
|
7
|
+
attr_reader :document, :options
|
8
8
|
|
9
9
|
# Initializing a related association only requires looking up the object
|
10
10
|
# by its id.
|
@@ -35,9 +35,8 @@ module Mongoid #:nodoc:
|
|
35
35
|
# association, and the attributes will be passed into the constructor.
|
36
36
|
#
|
37
37
|
# Returns the newly created object.
|
38
|
-
def build(attributes)
|
38
|
+
def build(attributes = {})
|
39
39
|
object = @klass.instantiate(attributes)
|
40
|
-
object.parentize(@parent, @association_name)
|
41
40
|
push(object)
|
42
41
|
object
|
43
42
|
end
|
@@ -20,7 +20,7 @@ module Mongoid #:nodoc:
|
|
20
20
|
# association, and the attributes will be passed into the constructor.
|
21
21
|
#
|
22
22
|
# Returns the newly created object.
|
23
|
-
def build(attributes)
|
23
|
+
def build(attributes = {})
|
24
24
|
object = @klass.instantiate(attributes.merge(@foreign_key => @parent.id))
|
25
25
|
@documents << object
|
26
26
|
object
|
@@ -9,7 +9,7 @@ module Mongoid #:nodoc:
|
|
9
9
|
# Builds a new Document and sets it as the association.
|
10
10
|
#
|
11
11
|
# Returns the newly created object.
|
12
|
-
def build(attributes)
|
12
|
+
def build(attributes = {})
|
13
13
|
@document = @klass.instantiate(attributes)
|
14
14
|
@document.send("#{@foreign_key}=", @parent.id)
|
15
15
|
end
|
data/mongoid.gemspec
CHANGED