directiverecord 0.1.26 → 0.1.27

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc26fa9710b00e61650bf32c723af7b687a82b09
4
- data.tar.gz: 81ad26f3c3e8d3724c3d811f0ce4716a48743b95
3
+ metadata.gz: cc70bdc6154246ffdce6e0d4814560fef801f3e3
4
+ data.tar.gz: 28798e0aac7a3130d121fac1d826182e73510340
5
5
  SHA512:
6
- metadata.gz: 777881c9461b0e2596f1e355508cfe9e6b8306c3c7a0c2af94a0a87816a21074a38398426af5301477193087013404ec0261461b5c5fe319913ff724abab930c
7
- data.tar.gz: ef1bdb1dce944f4927a1ad83c8706270d655006d48f5981b5d769a0c366aceb52ff2c821bffc5e8c954ffee8cbed5108b7707a0fe403a82e2c6c60b14aa33f5c
6
+ metadata.gz: d8d91f3ac15f35e23e9888a25d3a7519c9ccafe4bb5bc5ed2b0e5bd3d7df9778b98065d97e7a6b415b76465f953c30b0660ac8fd2ca94bcf21fccdee80b2452f
7
+ data.tar.gz: c15c5467150524258c277507ef046a0ddd533f4e7dcaf3f834c199adc9571f2a8940629bfc7841f558c379a04fcab9abc2826500b5a135a2d39657a912c2c780
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = DirectiveRecord CHANGELOG
2
2
 
3
+ == Version 0.1.27 (July 9, 2015)
4
+
5
+ * Including extra join conditions
6
+
3
7
  == Version 0.1.26 (June 9, 2015)
4
8
 
5
9
  * Fixed error when optimizing a query containing an ordered calculated column
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.26
1
+ 0.1.27
@@ -45,7 +45,7 @@ ON #{on}#{order}#{limit}#{offset}
45
45
  SQL
46
46
  end
47
47
 
48
- private
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
- joins.push "LEFT JOIN #{join_table} #{join_table_as} ON #{join_table_as}.#{join_table_column} = #{table_as}.#{table_column}"
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
@@ -1,7 +1,7 @@
1
1
  module DirectiveRecord
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 26
4
+ TINY = 27
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
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.26
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-06-09 00:00:00.000000000 Z
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.2.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