directiverecord 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/directive_record/query/sql.rb +9 -4
- 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: cc70bdc6154246ffdce6e0d4814560fef801f3e3
|
4
|
+
data.tar.gz: 28798e0aac7a3130d121fac1d826182e73510340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d91f3ac15f35e23e9888a25d3a7519c9ccafe4bb5bc5ed2b0e5bd3d7df9778b98065d97e7a6b415b76465f953c30b0660ac8fd2ca94bcf21fccdee80b2452f
|
7
|
+
data.tar.gz: c15c5467150524258c277507ef046a0ddd533f4e7dcaf3f834c199adc9571f2a8940629bfc7841f558c379a04fcab9abc2826500b5a135a2d39657a912c2c780
|
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.27
|
@@ -45,7 +45,7 @@ ON #{on}#{order}#{limit}#{offset}
|
|
45
45
|
SQL
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
protected
|
49
49
|
|
50
50
|
def path_delimiter; end
|
51
51
|
|
@@ -327,7 +327,7 @@ SQL
|
|
327
327
|
def parse_joins!(options)
|
328
328
|
return if (paths = extract_paths(options)).empty?
|
329
329
|
|
330
|
-
regexp = /INNER JOIN `([^`]+)`( `[^`]+`)? ON `[^`]+`.`([^`]+)` = `[^`]+`.`([^`]+)
|
330
|
+
regexp = /INNER JOIN `([^`]+)`( `[^`]+`)? ON `[^`]+`.`([^`]+)` = `[^`]+`.`([^`]+)`( AND .*)?/
|
331
331
|
|
332
332
|
options[:joins] = paths.collect do |path|
|
333
333
|
joins, associations = [], []
|
@@ -340,7 +340,7 @@ SQL
|
|
340
340
|
|
341
341
|
table_joins.each_with_index do |table_join, index|
|
342
342
|
concerns_bridge_table_join = concerns_bridge_table && index == 0
|
343
|
-
join_table, possible_alias, join_table_column, table_column = table_join
|
343
|
+
join_table, possible_alias, join_table_column, table_column, conditions = table_join
|
344
344
|
|
345
345
|
table_as = (klass == base) ? base_alias : quote_alias(associations.join(path_delimiter))
|
346
346
|
join_table_as = quote_alias((associations + [association]).join(path_delimiter))
|
@@ -353,7 +353,12 @@ SQL
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
-
|
356
|
+
if conditions
|
357
|
+
sql = self.class.new(klass.reflect_on_association(association).klass)
|
358
|
+
conditions = sql.prepend_base_alias(conditions).gsub(sql.base_alias, join_table_as)
|
359
|
+
end
|
360
|
+
|
361
|
+
joins.push "LEFT JOIN #{join_table} #{join_table_as} ON #{join_table_as}.#{join_table_column} = #{table_as}.#{table_column}#{conditions}"
|
357
362
|
end
|
358
363
|
|
359
364
|
associations << association
|
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.27
|
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-07-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.4.3
|
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
|