goldiloader 2.1.0 → 2.1.1

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
  SHA1:
3
- metadata.gz: 47531442377d70a4496f4c0e7887d1f907a8ca47
4
- data.tar.gz: 8237c5844f7b0f0fb64b284f6d1cfb674f7faf2f
3
+ metadata.gz: 7d32eaea199d074ab8988ec521e8a4ee67a0bf55
4
+ data.tar.gz: 57c03bce045cb49c4aa70e47486ef36c56da654f
5
5
  SHA512:
6
- metadata.gz: 899cc984c1e472134d7217d33f3d4873edde8f9ccdceba32a11a344893f43c5dc0d6d28395e839a2cbcd6a8e53f92bd8d188cbef995224ba2e6456484274a370
7
- data.tar.gz: 10cb34ba3adcaac3c769568aaa6195d0dd7a8d0f00acbea222572a0a50afa7e4f9c2433d068b082c25b77277052b3c78aba64e7fc20afc0f37c6a74596ac5b1a
6
+ metadata.gz: deab2653b8827c4b58b284229e87fc8af127c56101551e0e6b20c709c258f5c6713d998906308a6dd16bd00aab228ecc5bb4b1a255773722d5ccf74568c30cf1
7
+ data.tar.gz: 54cca5bde1209f5f413a6bdd4f98fd286626022ecb03c23ccbde6de6c9cf34b0fe684507d5d1def4d91e14614737c3783eb322097592b51d68f145f89d71624c
@@ -100,8 +100,8 @@ module Goldiloader
100
100
  association_info = Goldiloader::AssociationInfo.new(self)
101
101
  !association_info.limit? &&
102
102
  !association_info.offset? &&
103
- !association_info.group? &&
104
- !association_info.from? &&
103
+ (!association_info.group? || ::Goldiloader::Compatibility.group_eager_loadable?) &&
104
+ (!association_info.from? || ::Goldiloader::Compatibility.from_eager_loadable?) &&
105
105
  !association_info.instance_dependent? &&
106
106
  association_info.auto_include? &&
107
107
  (!owner.destroyed? || ::Goldiloader::Compatibility.destroyed_model_associations_eager_loadable?)
@@ -4,6 +4,11 @@ module Goldiloader
4
4
  module Compatibility
5
5
  ACTIVE_RECORD_VERSION = ::Gem::Version.new(::ActiveRecord::VERSION::STRING)
6
6
  PRE_RAILS_5_2 = ACTIVE_RECORD_VERSION < ::Gem::Version.new('5.2.0')
7
+ POST_RAILS_5_1_4 = ACTIVE_RECORD_VERSION > ::Gem::Version.new('5.1.5')
8
+ PRE_RAILS_5_1_5 = ACTIVE_RECORD_VERSION < ::Gem::Version.new('5.1.5')
9
+ FROM_EAGER_LOADABLE = ACTIVE_RECORD_VERSION >= ::Gem::Version.new('5.1.5') ||
10
+ (ACTIVE_RECORD_VERSION >= ::Gem::Version.new('5.0.7') && ACTIVE_RECORD_VERSION < ::Gem::Version.new('5.1.0'))
11
+ GROUP_EAGER_LOADABLE = FROM_EAGER_LOADABLE
7
12
 
8
13
  def self.rails_4?
9
14
  ::ActiveRecord::VERSION::MAJOR == 4
@@ -17,5 +22,13 @@ module Goldiloader
17
22
  def self.destroyed_model_associations_eager_loadable?
18
23
  PRE_RAILS_5_2
19
24
  end
25
+
26
+ def self.from_eager_loadable?
27
+ FROM_EAGER_LOADABLE
28
+ end
29
+
30
+ def self.group_eager_loadable?
31
+ GROUP_EAGER_LOADABLE
32
+ end
20
33
  end
21
34
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Goldiloader
4
- VERSION = '2.1.0'.freeze
4
+ VERSION = '2.1.1'.freeze
5
5
  end
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: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Turkel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2018-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord