source_ids 0.0.5 → 0.0.6
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.rb +8 -4
- data/lib/source_ids/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162b8ff56a263000ad1c34c9886bf7dbcd2b474f
|
4
|
+
data.tar.gz: 86310243427fd118d9d21d25129129eff6c3c7b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9ed11c2c4a6b839bef80c3f8667f61fab36e76f0f24fd9bf254eb8c995a63a7fccb4cc44375159b402c7883644ad28198adb1f195480f931022f0592b22f76
|
7
|
+
data.tar.gz: 43572c3c4f923df3751aa46c524d0d95e563dc5c1e01c2e8ab843e4b636d35146f561b5a946eda34c25bd4595f434de07d402a0dd7201420a9bba82c51e9c5c5
|
data/lib/source_ids.rb
CHANGED
@@ -19,10 +19,14 @@ module SourceIds
|
|
19
19
|
define_method "_#{source_ids_name}=" do |ids|
|
20
20
|
ids = ids.find_all(&:present?).map(&:to_s) # care for hidden field of collection_select
|
21
21
|
|
22
|
-
#
|
23
|
-
send(relation.name).
|
24
|
-
|
25
|
-
r.
|
22
|
+
# removing
|
23
|
+
removed = send(relation.name).find_all{|r| !ids.include?(r.send(fk_in_relation).to_s) }
|
24
|
+
removed.each do |r|
|
25
|
+
if r.new_record?
|
26
|
+
send(relation.name).delete(r)
|
27
|
+
else
|
28
|
+
r.mark_for_destruction
|
29
|
+
end
|
26
30
|
end
|
27
31
|
|
28
32
|
ids.each do |source_id|
|
data/lib/source_ids/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: source_ids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nay3
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|