blueprinter-activerecord 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bec64f8859b0d2cea3346675d4b2a3279245bcb5f7060b0ba0bfcf2f3bb4d83
|
4
|
+
data.tar.gz: 4fe808fc8be1d043bc18d53dbe3e6a02c40904408ed51f6a8d0fbe0fc1349b2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f20ed5466369e302e0e8d73bae2bade4fa92cd7efa6ae2bba63eb49494af7990cbc74d371f6c7f4efe782a94ae4d001fbc2dfdbce7a2358771ce6fdc748442c
|
7
|
+
data.tar.gz: 86b01a869b55e52ac6cfbac55dacb149112a01409ec004d7c55e4ef79451d5716327aa4aa04b8777aef2d68e000498d66f04c813e25d098ad985948bc103ad77
|
@@ -28,16 +28,17 @@ module BlueprinterActiveRecord
|
|
28
28
|
|
29
29
|
#
|
30
30
|
# Implements the "pre_render" Blueprinter Extension to preload associations from a view.
|
31
|
-
# If auto is true, all ActiveRecord::Relation
|
32
|
-
# only queries that have called `.preload_blueprint`
|
31
|
+
# If auto is true, all ActiveRecord::Relation and ActiveRecord::AssociationRelation objects
|
32
|
+
# will be preloaded. If auto is false, only queries that have called `.preload_blueprint`
|
33
|
+
# will be preloaded.
|
33
34
|
#
|
34
35
|
# NOTE: If auto is on, *don't* be concerned that you'll end up with duplicate preloads. Even if
|
35
36
|
# the query ends up with overlapping members in 'preload' and 'includes', ActiveRecord
|
36
37
|
# intelligently handles them. There are several unit tests which confirm this behavior.
|
37
38
|
#
|
38
39
|
def pre_render(object, blueprint, view, options)
|
39
|
-
case object
|
40
|
-
when ActiveRecord::Relation
|
40
|
+
case object.class.name
|
41
|
+
when "ActiveRecord::Relation", "ActiveRecord::AssociationRelation"
|
41
42
|
if object.preload_blueprint_method || auto || auto_proc&.call(object, blueprint, view, options) == true
|
42
43
|
object.before_preload_blueprint = extract_preloads object
|
43
44
|
blueprint_preloads = self.class.preloads(blueprint, view, object.model)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueprinter-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Procore Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '
|
151
|
+
version: '3.0'
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
154
|
- - ">="
|
@@ -158,5 +158,5 @@ requirements: []
|
|
158
158
|
rubygems_version: 3.4.19
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
|
-
summary: Extensions for using
|
161
|
+
summary: Extensions for using Blueprinter with ActiveRecord
|
162
162
|
test_files: []
|