activemodel-embedding 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2780103f79ecfcaf7824e83db61ca4391b598835bd470e42af26623e496ce610
|
4
|
+
data.tar.gz: 78d41771cde753e632f9011976a5f450a347f5c7228bca10396b51e352452cb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cb38dc53926813cfc9b619563642155d8e6173d2d7687d4965fadf838f1950577306f08bff37847a8600d20da9c795ac70bef9ffbc175fe45059250e7d2f412
|
7
|
+
data.tar.gz: ed7653f0dc4ada82380362746254848d45f42b6483960c832f21f48536ff69592d601385996b2a28e0381805ec97e7ca02b904ffde6bdf8f91aea7e91c7bdcd4
|
@@ -22,7 +22,7 @@ module ActiveModel
|
|
22
22
|
documents_attributes.each do |index, document_attributes|
|
23
23
|
index = index.to_i
|
24
24
|
id = fetch_id(document_attributes) || index
|
25
|
-
document =
|
25
|
+
document = find_by_id id if id
|
26
26
|
|
27
27
|
unless document
|
28
28
|
document = documents[index] || build
|
@@ -33,7 +33,7 @@ module ActiveModel
|
|
33
33
|
when Array
|
34
34
|
documents_attributes.each do |document_attributes|
|
35
35
|
id = fetch_id(document_attributes)
|
36
|
-
document =
|
36
|
+
document = find_by_id id if id
|
37
37
|
|
38
38
|
unless document
|
39
39
|
document = build
|
@@ -46,7 +46,7 @@ module ActiveModel
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
49
|
+
def find_by_id(id)
|
50
50
|
documents.find { |document| document.id == id }
|
51
51
|
end
|
52
52
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activemodel-embedding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mansakondo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|