eager_group 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +9 -6
- data/eager_group.gemspec +1 -1
- data/lib/eager_group/preloader.rb +1 -0
- data/lib/eager_group/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 36652bc032832f5a84dc02733286cd156a3253b8c1ba3b1b9289fec7686745d7
|
4
|
+
data.tar.gz: da2a878d043e2a02abb5f64c6d1c679dd02fe02220ba6399f5312e1ee096f953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7b4aacb136f425da49b81bf4d34c4bb467abc940b05fb936bd364b6884a322330acdec85449008de6f64716adc461ffebcad7a4b760f58fb44187b6abd2f3ba
|
7
|
+
data.tar.gz: 550d2eb69a366f90227c15382e25044078731610caae901982478baef95935dd581fc3b2a3affa04c48cab92a340d84744c18aeb5cb0a865a083ea78cee7bd69
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# EagerGroup
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/
|
3
|
+
[![Build Status](https://secure.travis-ci.org/flyerhzm/eager_group.png)](http://travis-ci.org/flyerhzm/eager_group)
|
4
4
|
[![AwesomeCode Status for
|
5
|
-
|
5
|
+
flyerhzm/eager_group](https://awesomecode.io/projects/e5386790-9420-4003-831a-c9a8c8a48108/status)](https://awesomecode.io/repos/flyerhzm/eager_group)
|
6
6
|
|
7
|
-
[More explaination on our blog](http://blog.
|
7
|
+
[More explaination on our blog](http://blog.flyerhzm.com/2015/06/29/eager_group/)
|
8
8
|
|
9
9
|
Fix n+1 aggregate sql functions for rails, like
|
10
10
|
|
@@ -99,7 +99,10 @@ but it would not help you to fix n+1 aggregate sql issue.
|
|
99
99
|
|
100
100
|
## Advanced
|
101
101
|
|
102
|
-
|
102
|
+
```ruby
|
103
|
+
User.limit(10).includes(:posts).eager_group(posts: [:comments_average_rating, :approved_comments_count])
|
104
|
+
```
|
105
|
+
|
103
106
|
|
104
107
|
## Benchmark
|
105
108
|
|
@@ -109,6 +112,6 @@ times faster, WOW!
|
|
109
112
|
|
110
113
|
## Contributing
|
111
114
|
|
112
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
115
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/flyerhzm/eager_group.
|
113
116
|
|
114
|
-
[1]: https://github.com/
|
117
|
+
[1]: https://github.com/flyerhzm/eager_group/blob/master/benchmark.rb
|
data/eager_group.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
|
13
13
|
spec.summary = 'Fix n+1 aggregate sql functions'
|
14
14
|
spec.description = 'Fix n+1 aggregate sql functions for rails'
|
15
|
-
spec.homepage = 'https://github.com/
|
15
|
+
spec.homepage = 'https://github.com/flyerhzm/eager_group'
|
16
16
|
|
17
17
|
spec.license = 'MIT'
|
18
18
|
|
@@ -16,6 +16,7 @@ module EagerGroup
|
|
16
16
|
if definition_key.is_a?(Hash)
|
17
17
|
association_name, definition_key = *definition_key.first
|
18
18
|
@records = @records.flat_map { |record| record.send(association_name) }
|
19
|
+
next if @records.empty?
|
19
20
|
@klass = @records.first.class
|
20
21
|
end
|
21
22
|
record_ids = @records.map { |record| record.send(primary_key) }
|
data/lib/eager_group/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eager_group
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -133,7 +133,7 @@ files:
|
|
133
133
|
- lib/eager_group/definition.rb
|
134
134
|
- lib/eager_group/preloader.rb
|
135
135
|
- lib/eager_group/version.rb
|
136
|
-
homepage: https://github.com/
|
136
|
+
homepage: https://github.com/flyerhzm/eager_group
|
137
137
|
licenses:
|
138
138
|
- MIT
|
139
139
|
metadata: {}
|
@@ -152,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
|
156
|
-
rubygems_version: 2.6.14
|
155
|
+
rubygems_version: 3.0.1
|
157
156
|
signing_key:
|
158
157
|
specification_version: 4
|
159
158
|
summary: Fix n+1 aggregate sql functions
|