directiverecord 0.1.25 → 0.1.26
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 +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/directive_record/query/sql.rb +3 -1
- data/lib/directive_record/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc26fa9710b00e61650bf32c723af7b687a82b09
|
4
|
+
data.tar.gz: 81ad26f3c3e8d3724c3d811f0ce4716a48743b95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777881c9461b0e2596f1e355508cfe9e6b8306c3c7a0c2af94a0a87816a21074a38398426af5301477193087013404ec0261461b5c5fe319913ff724abab930c
|
7
|
+
data.tar.gz: ef1bdb1dce944f4927a1ad83c8706270d655006d48f5981b5d769a0c366aceb52ff2c821bffc5e8c954ffee8cbed5108b7707a0fe403a82e2c6c60b14aa33f5c
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
= DirectiveRecord CHANGELOG
|
2
2
|
|
3
|
+
== Version 0.1.26 (June 9, 2015)
|
4
|
+
|
5
|
+
* Fixed error when optimizing a query containing an ordered calculated column
|
6
|
+
|
3
7
|
== Version 0.1.25 (May 20, 2015)
|
4
8
|
|
5
9
|
* Not assuming that an ActiveRelation where value contains a table alias to a corresponding association
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.26
|
@@ -93,7 +93,9 @@ SQL
|
|
93
93
|
def optimize_query!(options)
|
94
94
|
select = options[:select]
|
95
95
|
if options[:optimize] && (select != %w(id)) && select.any?{|x| x.match(/^\w+(\.\w+)+$/)}
|
96
|
-
|
96
|
+
order_by = options[:order_by] || []
|
97
|
+
select = ["id"] + select.select{|x| x.match(/ AS (\w+)$/) && order_by.any?{|y| y.include?(quote_alias($1))}}
|
98
|
+
ids = base.connection.select_values(to_sql(options.merge(:select => select))).uniq + [0]
|
97
99
|
options[:where] = ["id IN (#{ids.join(", ")})"]
|
98
100
|
options.delete :limit
|
99
101
|
options.delete :offset
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: directiverecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Engel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.2.2
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: A layer on top of ActiveRecord for using paths within queries without thinking
|