mongoid-embedded_copy 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongoid/embedded_copy/version.rb +1 -1
- data/lib/mongoid/embedded_copy.rb +11 -7
- data/test/test_helper.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7072bf2f0505119bffa05338cffdee1f557a808e
|
4
|
+
data.tar.gz: 3fb24208017739ca2c6cb3820ca6af758951ea62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7a9ae7a35e68a584ccb61a78b1326292eea0c460d4e52216a8ab5c81298abcdac95de0a0a2083fd9fd50f6752184b9a8404ad4093360093e7fd24d736c15f2
|
7
|
+
data.tar.gz: a5e541795750ba55fa8b9b05df5adfdbb3477d93e0d81f78ed9d40628977dfed96b77bc00b06ee4e76aa26330589c69bcc33327bdbe6c8ee4f5b177375c3fac9
|
@@ -67,7 +67,7 @@ module Mongoid
|
|
67
67
|
embedded_in embed_name, embed_opts
|
68
68
|
|
69
69
|
klass.fields.each do |name, f|
|
70
|
-
next if skipped.include?(name) || name == '_id'
|
70
|
+
next if skipped.include?(name) || name == '_id' || f.metadata
|
71
71
|
options = f.options.dup
|
72
72
|
options.delete(:klass)
|
73
73
|
field name, options
|
@@ -80,6 +80,13 @@ module Mongoid
|
|
80
80
|
alias_method_chain "#{name}=", :update_original
|
81
81
|
end
|
82
82
|
end
|
83
|
+
|
84
|
+
klass.relations.each do |name, rel|
|
85
|
+
next if skipped.include?(name)
|
86
|
+
options = rel.relation.valid_options +
|
87
|
+
Mongoid::Relations::Options::COMMON
|
88
|
+
public_send(rel.macro, name, rel.to_h.slice(options))
|
89
|
+
end
|
83
90
|
end
|
84
91
|
|
85
92
|
def load_original
|
@@ -87,13 +94,10 @@ module Mongoid
|
|
87
94
|
end
|
88
95
|
end
|
89
96
|
|
90
|
-
if klass.const_defined?(embedded_class)
|
91
|
-
klass.
|
92
|
-
else
|
93
|
-
klass.const_set(embedded_class, Class.new do
|
94
|
-
include document_module
|
95
|
-
end)
|
97
|
+
if !klass.const_defined?(embedded_class)
|
98
|
+
klass.const_set(embedded_class, Class.new)
|
96
99
|
end
|
100
|
+
klass.const_get(embedded_class).send(:include, document_module)
|
97
101
|
end
|
98
102
|
|
99
103
|
def self.equality_module_for(klass)
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-embedded_copy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Planquart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -84,6 +84,6 @@ test_files:
|
|
84
84
|
- test/models/user.rb
|
85
85
|
- test/models/post.rb
|
86
86
|
- test/mongoid.yml
|
87
|
-
- test/test_helper.rb
|
88
87
|
- test/embedded_copy_test.rb
|
88
|
+
- test/test_helper.rb
|
89
89
|
has_rdoc:
|