custom_fields 1.0.0.beta.24 → 1.0.0.beta.25
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.
@@ -53,6 +53,11 @@ module CustomFields
|
|
53
53
|
|
54
54
|
alias :length :size
|
55
55
|
|
56
|
+
def reload
|
57
|
+
self.collection(true)
|
58
|
+
self
|
59
|
+
end
|
60
|
+
|
56
61
|
def method_missing(name, *args, &block)
|
57
62
|
self.values.send(name, *args, &block)
|
58
63
|
end
|
@@ -74,12 +79,18 @@ module CustomFields
|
|
74
79
|
end
|
75
80
|
|
76
81
|
def collection(reload_embedded = false)
|
82
|
+
return [] if self.target_klass.nil?
|
83
|
+
|
77
84
|
if self.target_klass.embedded?
|
78
|
-
|
85
|
+
if @embedded_collection.nil? || reload_embedded
|
86
|
+
parent_target = self.target_klass._parent
|
87
|
+
|
88
|
+
parent_target = parent_target.reload if reload_embedded
|
79
89
|
|
80
|
-
|
90
|
+
@embedded_collection = parent_target.send(self.target_klass.association_name)
|
91
|
+
end
|
81
92
|
|
82
|
-
|
93
|
+
@embedded_collection
|
83
94
|
else
|
84
95
|
self.target_klass
|
85
96
|
end
|
@@ -80,7 +80,7 @@ module CustomFields
|
|
80
80
|
klass.class_eval <<-EOF
|
81
81
|
def build_#{self.safe_alias.singularize}_proxy_collection
|
82
82
|
::CustomFields::Types::HasMany::ProxyCollection.new(self, self.#{self.safe_alias}_klass, '#{self._name}').tap do |collection|
|
83
|
-
collection.update(self.#{self._name})
|
83
|
+
collection.reload.update(self.#{self._name})
|
84
84
|
end
|
85
85
|
end
|
86
86
|
EOF
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: custom_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 1.0.0.beta.
|
5
|
+
version: 1.0.0.beta.25
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Didier Lafforgue
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-31 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mongoid
|
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
hash: -
|
88
|
+
hash: -976967473644545936
|
89
89
|
segments:
|
90
90
|
- 0
|
91
91
|
version: "0"
|