joiner 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c51cc06024d77670209708823110edc631757a07f79c6631fac84329dba5670
4
- data.tar.gz: 7f6f23f6052291f3fa67782f10ca86345d0755f1c2cb410af45506a3952895dd
3
+ metadata.gz: 2957665feb464601c460d97d553e3aac9b4c00229dd971585842e41b03a0ce15
4
+ data.tar.gz: e4af3be0d65da1f2f03875ff541c68dc854411d1f80fe2509bc237ce64c39e92
5
5
  SHA512:
6
- metadata.gz: 5370c3e5b27a66c573e904b70313c28274998c3d47801b166bf4801c3bb053907bad854b13533cb258a545b7cb330e22ba0ca1f84f1937591fcb9c908cb28370
7
- data.tar.gz: 410f9e1c16727d3ec73c685bbe634e16c93182f63295ac7e117418d663b6d3160e2088515996d683de95634f74b2fa43fcd32698bbb5312accc09b0c32fe5443
6
+ metadata.gz: 1114b267101aa3bb1b5486bf35d518cd684119b7b8ba412cdb2f66d0ac1056f1c34b4f2e262a2a0b58610c9dbe855180336a318f1f606a80cadfdefc073ae9d5
7
+ data.tar.gz: fbfd4b013dfc3fc73be7295d8392e58e78a229c57809616ebfdc3f6f92932eccbd5a8b45f5787ee68dc5f4488eea2b09d8a3662ead2149ee98b1c7a729eb35a5
data/README.md CHANGED
@@ -9,7 +9,7 @@ If this gem is used by anyone other than myself/Thinking Sphinx, I'll be surpris
9
9
  It's a gem - so you can either install it yourself, or add it to the appropriate Gemfile or gemspec.
10
10
 
11
11
  ```term
12
- gem install joiner --version 0.4.0
12
+ gem install joiner --version 0.4.1
13
13
  ```
14
14
 
15
15
  ## Usage
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'joiner'
4
- spec.version = '0.4.0'
4
+ spec.version = '0.4.1'
5
5
  spec.authors = ['Pat Allan']
6
6
  spec.email = ['pat@freelancing-gods.com']
7
7
  spec.summary = %q{Builds ActiveRecord joins from association paths}
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.add_runtime_dependency 'activerecord', '>= 5.2.beta1'
17
17
 
18
18
  spec.add_development_dependency 'combustion', '~> 0.8'
19
- spec.add_development_dependency 'rails', '>= 5.2.0'
19
+ spec.add_development_dependency 'rails', '>= 5.2.1'
20
20
  spec.add_development_dependency 'rspec-rails', '~> 3'
21
21
  spec.add_development_dependency 'sqlite3', '~> 1.3.8'
22
22
  end
@@ -1,5 +1,8 @@
1
1
  class Joiner::JoinDependency < ActiveRecord::Associations::JoinDependency
2
- def join_association_for(path)
2
+ def join_association_for(path, alias_tracker)
3
+ @alias_tracker = alias_tracker
4
+ construct_tables! join_root
5
+
3
6
  path.inject(join_root) do |node, piece|
4
7
  node.children.detect { |child| child.reflection.name == piece }
5
8
  end
@@ -19,11 +19,11 @@ class Joiner::Joins
19
19
  return model.table_name if path.empty?
20
20
 
21
21
  add_join_to path
22
- join_values.join_association_for(path).tables.first.name
22
+ join_values.join_association_for(path, alias_tracker).tables.first.name
23
23
  end
24
24
 
25
25
  def join_values
26
- Joiner::JoinDependency.new model, table, joins_cache.to_a, alias_tracker
26
+ Joiner::JoinDependency.new model, table, joins_cache.to_a
27
27
  end
28
28
 
29
29
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2018-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 5.2.0
47
+ version: 5.2.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 5.2.0
54
+ version: 5.2.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
57
  requirement: !ruby/object:Gem::Requirement