cleaning_cloth 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b43756405b22f354e81b726162ecee53e0ba2047
4
- data.tar.gz: b807744b693f4c1de17cd0b6a7efeed4da3540fb
3
+ metadata.gz: 48f8db1b06e99e5deb73c69722c3e3b3fef32be3
4
+ data.tar.gz: 275a2471c74a815b4780381fe2641a78fc965738
5
5
  SHA512:
6
- metadata.gz: 9712599dee4a53d864a1d67f8f8524865d2f0e538f573c937e6f67892e0c0f34bf4eaf79da588fe67600f79f9dfabbd913019b8348042ee16629bac6768cc9d7
7
- data.tar.gz: e626bd5359949b43ccac4b14ea679a85b2148ab0d7abea50b758e51de2b836ffb9d8f8a8361c6b6a732484692520f81ac5e19d3323ce6f79286dfccd164f3569
6
+ metadata.gz: c05d9d6f0df6d45a611a7ff96c0f5abf110cf617d0d3ff27ee808d9e8a7f2a43605d1acdad70a4ee0d587eb672a60237d051b42ce242caa4024e58192e585049
7
+ data.tar.gz: 762e12cf0ea352b6ecbd1768c66389bbfe1d3e8ebe364f44caa406b72e3dc4a7373505a8d5a110272649da61d04ff649ee6fad3142d587730d417d3968543f50
@@ -16,10 +16,17 @@ class ActiveRecord::Base
16
16
  exceptions.reject! {|item| includes.include?(item) }
17
17
 
18
18
  all_attributes = self.attributes || {}
19
+ all_associations = self.class.reflect_on_all_associations
20
+
21
+ assoc_exceptions = all_associations.map {|assoc| assoc.foreign_key }
22
+
23
+ exceptions += assoc_exceptions
24
+ exceptions.uniq!
25
+ exceptions.compact!
26
+ exceptions.map! &:to_sym
19
27
 
20
28
  unless exceptions.include? :all_associations
21
- all_associations = self.class.reflect_on_all_associations
22
- all_associations.reject! {|item| exceptions.include?(item.name)}
29
+ all_associations.reject! {|item| exceptions.include?(item.name)}
23
30
 
24
31
  all_associations.each do |assoc|
25
32
  assoc_name = assoc.name
@@ -27,7 +34,6 @@ class ActiveRecord::Base
27
34
  next unless data.present?
28
35
  Array(data).each do |obj|
29
36
  obj_opts = opts.deep_fetch(assoc_name, {})
30
- obj_opts[:except] = Array(obj_opts[:except]) + [assoc.foreign_key.to_sym]
31
37
  obj_opts[:max_level] = opts[:max_level] - 1
32
38
  obj.clean! obj_opts
33
39
  end
@@ -1,3 +1,3 @@
1
1
  module CleaningCloth
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cleaning_cloth
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
  - nardele salomon