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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09032424ae9423bdbdefb4530ecacb06b9831023
4
- data.tar.gz: 765ea427f113ef3d3027fb1f916b984750d3499d
3
+ metadata.gz: 9eae94e024e26c29e17635515950b3dec3d0d4de
4
+ data.tar.gz: 41fe1a6d35230e90e949333c051884dc1e1fc1d6
5
5
  SHA512:
6
- metadata.gz: db9174981c81c68f94008e77cf3159fa3d7e029f1cf2815a82e31bb9011e7e21cc9cd537adf5c57c1769e4dc1b74215c9eda7bf5a76d919706ce95f063101b89
7
- data.tar.gz: 6ddbdaa7e326fd088afcc57166a32d871b946c675c09400aef798f26480c863ff68308b7f35bef77a0381114b179b073151847d40daa6b23ce1110d8e78631c7
6
+ metadata.gz: 0ae90ae4b4e693dcf1dd82235bc16027723c0d4944a91e9eee0085667f9fbae085fecccb35791ef9d42a108580150160e2c9f03d637f2a772bd836c0ab2e0ac7
7
+ data.tar.gz: 94c3c3791f97afd51e2c14f0aabc1b689ac8ed3c193ce721d442352529d0c16d86bc159ded70ef96a412b04b990b3ae6a6d0255eb059ca21cde65f7aaf0a773c
@@ -1,3 +1,3 @@
1
1
  module SourceIds
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: source_ids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - nay3