model_driven_api 3.5.2 → 3.5.3

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
  SHA256:
3
- metadata.gz: 88257f82f9d8e14500f45f1a86267cfe147a2a473c1602c2f3f6d231c1008c7a
4
- data.tar.gz: 419d69318bf67a7b65dc62cfa45beff7043981194f9a620a66bcb95012710325
3
+ metadata.gz: a9c63c0404c13f3c0a73bc5959c4164184a07554a0cabe39b36af3b73123a341
4
+ data.tar.gz: 169edc727f279ec9be18dddb943fdab350183f5990ec8e64c83471cb3f44c01b
5
5
  SHA512:
6
- metadata.gz: 3f00531fd35976318e21d9c65cb4d98e23223ead8996278b4308ca4a93de53bc0ddc06bb5d84e2d05eb9f58f41d0aaf0609fea8ff968ed7d21aa1b4f1949f3cf
7
- data.tar.gz: 1e32db7edccdddc97f942f7a8ecdcaf15a103f67d89ccb1f0b776268d017368089218a5a6fb3c9c560ed831e83c6a663d3c158b1a61703d6ebf5d94e708ff611
6
+ metadata.gz: 4b1fcf103ac400e9ca7b41f6cca451a84d26425d57d252d4f3ac6a5a9b00e6c14762f16359efa213854e920cf63d479cf288140107b650ae0f62495107402f37
7
+ data.tar.gz: cca8e92d2023252c0058b2ff448aa51ccb2aa4929dca881cf822201a26f877623a14c47fc38010c29fc52634b5eca20287980fa3a72cb6f5c356648005dd042f
@@ -6,13 +6,20 @@ module AutoIncludeJson
6
6
  Rails.logger.debug "AutoIncludeJson - Building includes from: #{include_option.inspect} from #{caller_locations(1,1).first.label}"
7
7
  case include_option
8
8
  when Array
9
- include_option
9
+ include_option.map { |item| build_includes(item) }
10
10
  when Hash
11
11
  include_option.each_with_object({}) do |(assoc, value), hash|
12
+ # Skip keys that aren't associations
13
+ next if [:only, :except, :methods].include?(assoc)
14
+
12
15
  if value.is_a?(Hash) && value[:include]
13
16
  hash[assoc] = build_includes(value[:include])
17
+ elsif value.is_a?(Hash)
18
+ # If value is a hash, assume it might contain nested structure
19
+ nested = value.reject { |k, _| [:only, :except, :methods].include?(k) }
20
+ hash[assoc] = build_includes(nested) unless nested.empty?
14
21
  else
15
- hash[assoc] = {}
22
+ hash[assoc] = {} # eager load shallow association
16
23
  end
17
24
  end
18
25
  else
@@ -1,3 +1,3 @@
1
1
  module ModelDrivenApi
2
- VERSION = "3.5.2".freeze
2
+ VERSION = "3.5.3".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_driven_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni