source_ids 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/source_ids/version.rb +1 -1
- data/lib/source_ids.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eae94e024e26c29e17635515950b3dec3d0d4de
|
4
|
+
data.tar.gz: 41fe1a6d35230e90e949333c051884dc1e1fc1d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ae90ae4b4e693dcf1dd82235bc16027723c0d4944a91e9eee0085667f9fbae085fecccb35791ef9d42a108580150160e2c9f03d637f2a772bd836c0ab2e0ac7
|
7
|
+
data.tar.gz: 94c3c3791f97afd51e2c14f0aabc1b689ac8ed3c193ce721d442352529d0c16d86bc159ded70ef96a412b04b990b3ae6a6d0255eb059ca21cde65f7aaf0a773c
|
data/lib/source_ids/version.rb
CHANGED
data/lib/source_ids.rb
CHANGED
@@ -17,16 +17,16 @@ module SourceIds
|
|
17
17
|
|
18
18
|
# _source_ids=
|
19
19
|
define_method "_#{source_ids_name}=" do |ids|
|
20
|
-
ids = ids.find_all(&:present?) # care for hidden field of collection_select
|
20
|
+
ids = ids.find_all(&:present?).map(&:to_s) # care for hidden field of collection_select
|
21
21
|
|
22
22
|
# mark destruction if not included in ids
|
23
23
|
send(relation.name).each do |r|
|
24
24
|
source_id = r.send(fk_in_relation)
|
25
|
-
r.mark_for_destruction unless ids.include?(source_id)
|
25
|
+
r.mark_for_destruction unless ids.include?(source_id.to_s)
|
26
26
|
end
|
27
27
|
|
28
28
|
ids.each do |source_id|
|
29
|
-
unless send(relation.name).detect{|r| r.send(fk_in_relation) == source_id}
|
29
|
+
unless send(relation.name).detect{|r| r.send(fk_in_relation).to_s == source_id}
|
30
30
|
send(relation.name).build(fk_in_relation => source_id)
|
31
31
|
end
|
32
32
|
end
|
@@ -39,7 +39,7 @@ module SourceIds
|
|
39
39
|
elsif b.marked_for_destruction?
|
40
40
|
1
|
41
41
|
else
|
42
|
-
ids.index(a.send(fk_in_relation)) <=> ids.index(b.send(fk_in_relation))
|
42
|
+
ids.index(a.send(fk_in_relation).to_s) <=> ids.index(b.send(fk_in_relation).to_s)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|