goldiloader 5.2.0 → 5.2.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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e922f46493ed724f6da746c0c940fda408a79bdf37a8213a63ff2d0a73782d16
         | 
| 4 | 
            +
              data.tar.gz: d6a0e0bcb412979d4b07c0c2864ee2a7b3756079a6b6e2383af3b072a6290e44
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f2b1bfd0f1e6677f701ebe92082932e8ba9dcef5f537631d08be9b20b1d4b453c66eab281116e998a93d5018d6ed529a25aee3ddf362fe92aad6cbed6423d8c2
         | 
| 7 | 
            +
              data.tar.gz: 4a1a2e6ea0a9b34cfee1d24e43d3bdf1984b0388922b37943c06e29da41588f67df8d10622b9cc91515afa623dbe3a56070957d6b9b21f8e709ca74a01643c2d
         | 
| @@ -177,7 +177,20 @@ module Goldiloader | |
| 177 177 | 
             
                def auto_include?
         | 
| 178 178 | 
             
                  # Only auto include through associations if the target association is auto-loadable
         | 
| 179 179 | 
             
                  through_association = owner.association(through_reflection.name)
         | 
| 180 | 
            -
                   | 
| 180 | 
            +
                  auto_include_self = super
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                  # If the current association cannot be auto-included there is nothing we can do
         | 
| 183 | 
            +
                  return false unless auto_include_self
         | 
| 184 | 
            +
             | 
| 185 | 
            +
                  # If the through association can just be auto-included we're good
         | 
| 186 | 
            +
                  return true if through_association.auto_include?
         | 
| 187 | 
            +
             | 
| 188 | 
            +
                  # If the through association was already loaded and does not contain new, changed, or destroyed records
         | 
| 189 | 
            +
                  # we are also able to auto-include the association. It means it has only already been read or changes are
         | 
| 190 | 
            +
                  # already persisted.
         | 
| 191 | 
            +
                  through_association.loaded? && Array.wrap(through_association.target).none? do |record|
         | 
| 192 | 
            +
                    record.new_record? || record.changed? || record.destroyed?
         | 
| 193 | 
            +
                  end
         | 
| 181 194 | 
             
                end
         | 
| 182 195 | 
             
              end
         | 
| 183 196 | 
             
              ::ActiveRecord::Associations::HasManyThroughAssociation.prepend(::Goldiloader::ThroughAssociationPatch)
         | 
| @@ -199,3 +212,5 @@ module Goldiloader | |
| 199 212 | 
             
              end
         | 
| 200 213 | 
             
              ::ActiveRecord::Associations::CollectionProxy.prepend(::Goldiloader::CollectionProxyPatch)
         | 
| 201 214 | 
             
            end
         | 
| 215 | 
            +
             | 
| 216 | 
            +
            Goldiloader::AssociationOptions.register
         | 
    
        data/lib/goldiloader/version.rb
    CHANGED
    
    
    
        data/lib/goldiloader.rb
    CHANGED
    
    | @@ -1,14 +1,18 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'active_support/all'
         | 
| 4 | 
            -
            require 'active_record'
         | 
| 5 4 | 
             
            require 'goldiloader/compatibility'
         | 
| 6 5 | 
             
            require 'goldiloader/custom_preloads'
         | 
| 7 6 | 
             
            require 'goldiloader/auto_include_context'
         | 
| 8 7 | 
             
            require 'goldiloader/scope_info'
         | 
| 9 8 | 
             
            require 'goldiloader/association_options'
         | 
| 10 9 | 
             
            require 'goldiloader/association_loader'
         | 
| 11 | 
            -
             | 
| 10 | 
            +
             | 
| 11 | 
            +
            ActiveSupport.on_load(:active_record) do
         | 
| 12 | 
            +
              # Defer referencing ActiveRecord class until it's loaded
         | 
| 13 | 
            +
              # See https://github.com/rails/rails/issues/48704
         | 
| 14 | 
            +
              require 'goldiloader/active_record_patches'
         | 
| 15 | 
            +
            end
         | 
| 12 16 |  | 
| 13 17 | 
             
            module Goldiloader
         | 
| 14 18 | 
             
              class << self
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: goldiloader
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5.2. | 
| 4 | 
            +
              version: 5.2.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Joel Turkel
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2024-04-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activerecord
         |