subroutine 1.0.0.rc3 → 1.0.0.rc4
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 +4 -4
- data/lib/subroutine/association_fields.rb +6 -4
- data/lib/subroutine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bd9cb93ba6c09a520b8db4d79b6aa2e5eefee2046b5b8d768976864dd4a7c89
|
4
|
+
data.tar.gz: d5d0be02650acb97a25b3663f2722ace66f38ad2cb5457208da7ad1e3a2a9e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4eaa685e8fff642d134ba9f97b0050c1eee01639b4429ebe2d4a522ff88de544f58a4080372af3f91f210f656efbf9c37c8a6fbdea1f36468067408e5615913
|
7
|
+
data.tar.gz: e6b4c7fbadbaf6a1b8b8d765d962aed0acb7ba8c8f661b5b5c70da6b20d49458013d0f31ab34e0c4a7519452a568f8f9e51ee85f18be0a119ba62af1e24b1d94
|
@@ -105,8 +105,10 @@ module Subroutine
|
|
105
105
|
end
|
106
106
|
|
107
107
|
out = params.except(*excepts)
|
108
|
-
association_fields.each_pair do |field_name,
|
109
|
-
|
108
|
+
association_fields.each_pair do |field_name, config|
|
109
|
+
next unless field_provided?(field_name)
|
110
|
+
|
111
|
+
out[field_name] = config.field_reader? ? send(field_name) : get_field(field_name)
|
110
112
|
end
|
111
113
|
|
112
114
|
out
|
@@ -136,8 +138,8 @@ module Subroutine
|
|
136
138
|
stored_result = association_cache[config.field_name]
|
137
139
|
return stored_result unless stored_result.nil?
|
138
140
|
|
139
|
-
fk =
|
140
|
-
type = config.polymorphic? ?
|
141
|
+
fk = config.field_reader? ? send(config.foreign_key_method) : get_field(config.foreign_id_method)
|
142
|
+
type = config.field_reader? || !config.polymorphic? ? send(config.foreign_type_method) : get_field(config.foreign_type_method)
|
141
143
|
|
142
144
|
result = fetch_association_instance(type, fk, config.unscoped?)
|
143
145
|
association_cache[config.field_name] = result
|
data/lib/subroutine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subroutine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|