active_record_custom_preloader 1.0.0 → 2.0.0

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: '087d4fa01c068564e4d5610c7eca87a3966fbdd9b56cc4b82a42f4a041eab1b1'
4
- data.tar.gz: a5adb93c3bc7cf099470f5c77bce2c41d0de20c56972f3782b299593280d9ebe
3
+ metadata.gz: 7c5402d3636a7fc7337118a453032e0f0a38cf241e31f603842e109ae1e10b80
4
+ data.tar.gz: 8cc9d34c0075cb1194c3d36173886bb2be6297368216ddf49e4f9f1122505cfb
5
5
  SHA512:
6
- metadata.gz: 6bada7cc31ccd296f3e7c8029fed931aef8907cfd9bbedcbb3788b6c7f4d959bc1a5352e241091fe5132f11d42ba2576d375d6f207ce55e8f3e04d7612fbb088
7
- data.tar.gz: e3ce2a2539bb02352190cdb4264c854b6dfe42ca472da616515736678e7c183ec35e6971d2400b1ecf3a2acaa590351c83f40ee3d5af4d9bde1ba67a93d2bafc
6
+ metadata.gz: 9f463d113f55c2611f38eae30b9174ece10f06f9d0ead2b21f345234e2a93af628ebf153fc44e7c73667d9dc9eea295f7d016bf4522a179509a83ea730315b4a
7
+ data.tar.gz: e6ca5f43a6327cd9181a0d3503406634a394f88a7d890afddb99ef3baec266eef0b53b5222269161d149991c1cfa0aa37550b3d663bf3d61224ccd73d31b3545
@@ -3,7 +3,7 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.3.1
6
+ - 2.5.7
7
7
  env:
8
- - RAILS_VERSION=5.2.3
8
+ - RAILS_VERSION=6.0.1
9
9
  before_install: gem install bundler -v 2.0.1
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # ActiveRecordCustomPreloader
2
2
 
3
- custom preloader for ActiveRecord model
3
+ Custom preloader for ActiveRecord model.
4
+
5
+ Gem version `2.X.X` and `master` branch compatible with Rails `6.X.X` and upper.
6
+ For Rails `5.X.X` see branch `rails-5` and gem version `1.X.X`.
4
7
 
5
8
  ## Installation
6
9
 
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ['lib']
25
25
 
26
26
  spec.add_dependency 'activesupport'
27
- spec.add_dependency 'activerecord', '~> 5.0'
27
+ spec.add_dependency 'activerecord', '>= 6.0.0'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 2.0'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -5,23 +5,23 @@ module ActiveRecordCustomPreloader
5
5
  class AssociationsPreloader < ::ActiveRecord::Associations::Preloader
6
6
  private
7
7
 
8
- def preloaders_on(association, records, scope)
8
+ def preloaders_on(association, records, scope, polymorphic_parent = false)
9
9
  if association.is_a?(PreloadWithOptions)
10
- preloaders_for_one(association, records, scope)
10
+ preloaders_for_one(association, records, scope, polymorphic_parent)
11
11
  return
12
12
  end
13
13
 
14
14
  klass = records.first.class
15
15
  if klass.respond_to?(:has_custom_loader?) && klass.has_custom_loader?(association)
16
16
  association = PreloadWithOptions.new(association)
17
- preloaders_for_one(association, records, scope)
17
+ preloaders_for_one(association, records, scope, polymorphic_parent)
18
18
  return
19
19
  end
20
20
 
21
21
  super
22
22
  end
23
23
 
24
- def preloaders_for_one(association, records, scope)
24
+ def preloaders_for_one(association, records, scope, polymorphic_parent)
25
25
  if records.size > 0 && association.is_a?(PreloadWithOptions)
26
26
  association.loader_for(records.first.class).preload(records)
27
27
  return
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordCustomPreloader
2
- VERSION = '1.0.0'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_custom_preloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Talakevich
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: 6.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: 6.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -141,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.10
144
+ rubygems_version: 3.1.2
146
145
  signing_key:
147
146
  specification_version: 4
148
147
  summary: Custom preloader for ActiveRecord.