miscellany 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/miscellany/active_record/goldiload_value.rb +20 -0
- data/lib/miscellany/version.rb +1 -1
- data/lib/miscellany.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5951bc4a5a92a69c804727cd9e08c9059a3a28471ba86250407f4d791ef95815
|
4
|
+
data.tar.gz: d976b84948bd3427e533c79bccc5d76731bb66c5ecb67658cd3cd23b8b4b1667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0928268e504805adf73331fd43a760c45f0edbe36d6a1d5b3755d3b625806a31df5b1e5eb4fcc354bdfce69e1f5db135b1a346124b8f453bf56cd732072ff582'
|
7
|
+
data.tar.gz: fadada2364e7bff52b7a00899fb814e1b0458753f3a62a05824d885cbae9d01338fe2bb484ea2e2e8b96f275f9846e5bbbc4ebacfeb25e5970b1136e54e4f91a
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Miscellany
|
2
|
+
module GoldiloadValue
|
3
|
+
|
4
|
+
def goldiload_value(key, &blk)
|
5
|
+
return goldi_values[key] if goldi_values && goldi_values.key?(key)
|
6
|
+
|
7
|
+
models = auto_include_context.models
|
8
|
+
loaded = blk.call(models)
|
9
|
+
models.each do |m|
|
10
|
+
(m.goldi_values ||= {})[key] = loaded.key?(m) ? loaded[m] : loaded[m&.id]
|
11
|
+
end
|
12
|
+
|
13
|
+
goldi_values[key]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.install
|
17
|
+
::ActiveRecord::Base.include(GoldiloadValue)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/miscellany/version.rb
CHANGED
data/lib/miscellany.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miscellany
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan Knapp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/miscellany/active_record/batched_destruction.rb
|
116
116
|
- lib/miscellany/active_record/computed_columns.rb
|
117
117
|
- lib/miscellany/active_record/custom_preloaders.rb
|
118
|
+
- lib/miscellany/active_record/goldiload_value.rb
|
118
119
|
- lib/miscellany/batch_processor.rb
|
119
120
|
- lib/miscellany/batching_csv_processor.rb
|
120
121
|
- lib/miscellany/controller/http_error_handling.rb
|