miscellany 0.1.7 → 0.1.8
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
- 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: c746bac8225f832908693a4c5ec79af44fc936ea6a91457cd7b22e10d33114a4
|
4
|
+
data.tar.gz: 674c97648f5bda39bbc6a2025fdd35e103c6e0dbad56ef72a5e912dee15e6119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc8bea4728c5e04209cedaedd7d16a93b3e59fcc08ae52c4bffde09dc2f06be85dc03fafff6f406c2f04078bf6f71bd773e924d687d8046f6c4597b9f1e17c6e
|
7
|
+
data.tar.gz: efb98108c92e1047d70f96bd591893119b90c6a8cb9b5b3314258063d28313c785464a16def6f1b877a480f38527f0d0f6fa1ae5029854591cb8ea19441cfad2
|
@@ -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
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.8
|
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
|