active_record_custom_preloader 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: ea88d7f2390b0e45e10bd34521c31856bc6ef72f
4
- data.tar.gz: 465b71a9c3155369e73188a617bbaadad847322a
3
+ metadata.gz: cb12633dd33dca10db8ef101811d6b0350e901c1
4
+ data.tar.gz: 52588c79fe6e7e7f6c5912279a65105aa90d5176
5
5
  SHA512:
6
- metadata.gz: 57180386f8368ab09c39033d093a8952de62143dd81d98d62c37c355c75e098b27a24684f70fcfb4802d1ee7d09d29ada1ccfde0ee27acb25b9e028e2828d741
7
- data.tar.gz: 8ce168e2bcc13fe4dee152d6727103eddb57c67c601e7f4daa0904f795c8db257ce3286d2f56741c3c9e48fbb1c9b4f0314554eadb8048a71fefa7f85d98f7ac
6
+ metadata.gz: e874ed99f795a7c9be7857a94367f1ae1c8dc3bf6dbedf23479312f6b5cf0e546b99096649cef2e6e05055bdf90d590681ae77a64e7e0acb2ff3d937cb4205a3
7
+ data.tar.gz: d864d39edffb975976425713865d97b4c30323ec46dde3ef21526352d4bf5678773ee091d79a52e6825822ff6bd2baa718d0bb4e90aa9a33e7147b51b618798a
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'bundler', '~> 2.0'
30
30
  spec.add_development_dependency 'rake', '~> 10.0'
31
31
  spec.add_development_dependency 'minitest', '~> 5.0'
32
+ spec.add_development_dependency 'sqlite3'
32
33
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordCustomPreloader
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -45,7 +45,8 @@ module ActiveRecordCustomPreloader
45
45
  end
46
46
 
47
47
  # association table is queried by return value of this method.
48
- # returns array of keys for parent record to match association record
48
+ # returns array of keys for parent record to match association record.
49
+ # if you want to skip association for particular record - return nil.
49
50
  def record_foreign_keys(parent_record)
50
51
  association_foreign_keys(parent_record)
51
52
  end
@@ -71,7 +72,7 @@ module ActiveRecordCustomPreloader
71
72
  end
72
73
 
73
74
  def fetch_association(parent_records)
74
- keys = parent_records.map(&method(:record_foreign_keys))
75
+ keys = parent_records.map(&method(:record_foreign_keys)).compact
75
76
  condition_part = association_foreign_keys_names.map { |name| "#{name} = ?" }.join(' AND ')
76
77
  conditions = []
77
78
  keys.size.times { conditions.push(condition_part) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_custom_preloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Talakevich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sqlite3
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: Custom preloader for ActiveRecord.
84
98
  email:
85
99
  - senid231@gmail.com