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 CHANGED
@@ -1 +1 @@
1
- 0.10.0
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
- delegate :==, :to => :document
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
@@ -7,7 +7,7 @@ module Mongoid #:nodoc:
7
7
  attr_reader :association_name, :document, :parent, :options
8
8
 
9
9
  # Build a new object for the association.
10
- def build(attributes)
10
+ def build(attributes = {})
11
11
  @document = attributes.assimilate(@parent, @options)
12
12
  self
13
13
  end
@@ -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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid}
8
- s.version = "0.10.0"
8
+ s.version = "0.10.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Durran Jordan"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Durran Jordan