blueprinter-activerecord 1.0.1 → 1.0.2

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: f6a85ca09945cbc4bd824aef6b755904df11ac6438efb639a7f07789ace4834d
4
- data.tar.gz: c851665fed8b689589f3cde2a176cb7a50292f48d46bcddd8b4b88790a6adb83
3
+ metadata.gz: 7bec64f8859b0d2cea3346675d4b2a3279245bcb5f7060b0ba0bfcf2f3bb4d83
4
+ data.tar.gz: 4fe808fc8be1d043bc18d53dbe3e6a02c40904408ed51f6a8d0fbe0fc1349b2f
5
5
  SHA512:
6
- metadata.gz: 49f97296a38d1765754c31ba00c585ec78c978ca29ac4642eba4c100dc5f2cec52703349150feddca1f55cacf5a8bb2addb2dce50db33ca35c7ab20851615faf
7
- data.tar.gz: e5e92ab4e1fc3b7c9b3124d1b56573283e525539e0212bcbf73e38913dea83f8ee34775e85c3511e6b6d12f39100aff9f17d11a6b7e097e37a380fb9612f6381
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 objects will be preloaded. If auto is false,
32
- # only queries that have called `.preload_blueprint` will be preloaded.
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlueprinterActiveRecord
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
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.1
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-02-09 00:00:00.000000000 Z
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: '2.7'
151
+ version: '3.0'
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - ">="