occams-record 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 +4 -4
- data/README.md +1 -1
- data/lib/occams-record/eager_loaders/polymorphic_belongs_to.rb +2 -1
- data/lib/occams-record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e3dd68bf71573d7c7d69b5ec5ac6bc9fcee04a3
|
4
|
+
data.tar.gz: a8fffb0ad9a3d03d725753f260ffe168f8290624
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5358439480d4ad1cdd15635610b79bc389e1ca3cb32dd07292f54295bfa040e1c6e6f4f668f838e166ff3cf1396f0ff35096952df77aa4eaa999875083a812c8
|
7
|
+
data.tar.gz: 3d6396a193b98e4adc84c2e231329b02e1e02d479e65d7c46145375b99ba95f0aa0eca77feb3c16680325da08e2cd1c8c5e9bb350497428fb342fbe8ac77059e
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ For those stuck with ActiveRecord, OccamsRecord seeks to solve these issues by m
|
|
12
12
|
**What does this buy you?**
|
13
13
|
|
14
14
|
* OccamsRecord results are **one-third the size** of ActiveRecord results.
|
15
|
-
* OccamsRecord queries run **three times faster** than ActiveRecord queries
|
15
|
+
* OccamsRecord queries run **three to five times faster** than ActiveRecord queries.
|
16
16
|
* When you're eager loading associations you may specify which columns to `SELECT`. (This can be a significant performance boost to both your database and Rails app, on top of the above numbers.)
|
17
17
|
|
18
18
|
**What don't you give up?**
|
@@ -42,7 +42,8 @@ module OccamsRecord
|
|
42
42
|
# Merge associations of type N into rows of model N.
|
43
43
|
#
|
44
44
|
def merge!(assoc_rows_of_type, rows)
|
45
|
-
|
45
|
+
return if assoc_rows_of_type.empty?
|
46
|
+
type = assoc_rows_of_type[0].class.model_name
|
46
47
|
rows_of_type = rows.select { |r| r.send(@foreign_type) == type }
|
47
48
|
merge_model!(assoc_rows_of_type, rows_of_type, type.constantize)
|
48
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: occams-record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Hollinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|