mongoid 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/mongoid/associations/has_one.rb +3 -1
- data/mongoid.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.6
|
@@ -5,6 +5,8 @@ module Mongoid #:nodoc:
|
|
5
5
|
|
6
6
|
delegate :valid?, :to => :document
|
7
7
|
|
8
|
+
attr_accessor :klass
|
9
|
+
|
8
10
|
# Creates the new association by finding the attributes in
|
9
11
|
# the parent document with its name, and instantiating a
|
10
12
|
# new document for it.
|
@@ -13,7 +15,7 @@ module Mongoid #:nodoc:
|
|
13
15
|
# to the internal document itself.
|
14
16
|
def initialize(name, document, options = {})
|
15
17
|
class_name = options[:class_name]
|
16
|
-
klass = class_name ? class_name.constantize : name.to_s.camelize.constantize
|
18
|
+
@klass = class_name ? class_name.constantize : name.to_s.camelize.constantize
|
17
19
|
attributes = document.attributes[name]
|
18
20
|
@document = klass.instantiate(attributes || {})
|
19
21
|
@document.parentize(document, name)
|
data/mongoid.gemspec
CHANGED