joiner 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/README.md +2 -2
- data/joiner.gemspec +5 -5
- data/lib/joiner/join_dependency.rb +2 -5
- data/lib/joiner/joins.rb +6 -14
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76a7e71eaef54a09627a9d72231ab9fe99c966736a7c7bffbedcd110bcbcef4a
|
4
|
+
data.tar.gz: 8aed7b7b5081bf0c564ea7e81f6a2d229f4e5e0b45b4ce3aae89d15e19879d39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00b8286b10577f26e2999601cfb4cf5c73b213ef452fa8608ccbbb1b5d33cb27b0505b08fac73a90d951dc18f7f9636be1c2fb58e39ac073aa0fbed73298e516
|
7
|
+
data.tar.gz: 944cf099ea7df456ecfe2f52a21a624bef9e74154d524425e845312a626b4be5d72b264467a2fd38be4fdefd14097a88a1ee0fd40d1ba0009506664892c63b3b
|
data/.travis.yml
ADDED
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.
|
12
|
+
gem install joiner --version 0.5.0
|
13
13
|
```
|
14
14
|
|
15
15
|
## Usage
|
@@ -59,4 +59,4 @@ Please note that this project now has a [Contributor Code of Conduct](http://con
|
|
59
59
|
|
60
60
|
## Licence
|
61
61
|
|
62
|
-
Copyright (c) 2013-
|
62
|
+
Copyright (c) 2013-2019, Joiner is developed and maintained by [Pat Allan](http://freelancing-gods.com), and is released under the open MIT Licence.
|
data/joiner.gemspec
CHANGED
@@ -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
|
+
spec.version = '0.5.0'
|
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}
|
@@ -13,10 +13,10 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.test_files = spec.files.grep(%r{^(spec)/})
|
14
14
|
spec.require_paths = ['lib']
|
15
15
|
|
16
|
-
spec.add_runtime_dependency 'activerecord', '>=
|
16
|
+
spec.add_runtime_dependency 'activerecord', '>= 6.0.0.rc2'
|
17
17
|
|
18
|
-
spec.add_development_dependency 'combustion', '~>
|
19
|
-
spec.add_development_dependency 'rails', '>=
|
18
|
+
spec.add_development_dependency 'combustion', '~> 1.1'
|
19
|
+
spec.add_development_dependency 'rails', '>= 6.0.0.rc2'
|
20
20
|
spec.add_development_dependency 'rspec-rails', '~> 3'
|
21
|
-
spec.add_development_dependency 'sqlite3', '~> 1.
|
21
|
+
spec.add_development_dependency 'sqlite3', '~> 1.4'
|
22
22
|
end
|
@@ -1,10 +1,7 @@
|
|
1
1
|
class Joiner::JoinDependency < ActiveRecord::Associations::JoinDependency
|
2
2
|
def join_association_for(path, alias_tracker = nil)
|
3
|
-
|
4
|
-
|
5
|
-
@alias_tracker = alias_tracker
|
6
|
-
construct_tables! join_root
|
7
|
-
end
|
3
|
+
@alias_tracker = alias_tracker
|
4
|
+
construct_tables! join_root
|
8
5
|
|
9
6
|
path.inject(join_root) do |node, piece|
|
10
7
|
node.children.detect { |child| child.reflection.name == piece }
|
data/lib/joiner/joins.rb
CHANGED
@@ -2,6 +2,8 @@ require 'active_record'
|
|
2
2
|
require 'active_support/ordered_hash'
|
3
3
|
|
4
4
|
class Joiner::Joins
|
5
|
+
ACTIVE_RECORD_VERSION = Gem::Version.new(ActiveRecord::VERSION::STRING)
|
6
|
+
|
5
7
|
attr_reader :model
|
6
8
|
|
7
9
|
def initialize(model)
|
@@ -23,13 +25,9 @@ class Joiner::Joins
|
|
23
25
|
end
|
24
26
|
|
25
27
|
def join_values
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
else
|
30
|
-
# ActiveRecord 5.2.0
|
31
|
-
Joiner::JoinDependency.new model, table, joins_cache.to_a, alias_tracker
|
32
|
-
end
|
28
|
+
Joiner::JoinDependency.new(
|
29
|
+
model, table, joins_cache.to_a, Arel::Nodes::OuterJoin
|
30
|
+
)
|
33
31
|
end
|
34
32
|
|
35
33
|
private
|
@@ -43,13 +41,7 @@ class Joiner::Joins
|
|
43
41
|
end
|
44
42
|
|
45
43
|
def association_for(path)
|
46
|
-
|
47
|
-
# ActiveRecord 5.2.1+
|
48
|
-
join_values.join_association_for path, alias_tracker
|
49
|
-
else
|
50
|
-
# ActiveRecord 5.2.0
|
51
|
-
join_values.join_association_for path
|
52
|
-
end
|
44
|
+
join_values.join_association_for path, alias_tracker
|
53
45
|
end
|
54
46
|
|
55
47
|
def path_as_hash(path)
|
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
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.0.rc2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: combustion
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '1.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '1.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 6.0.0.rc2
|
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:
|
54
|
+
version: 6.0.0.rc2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: '1.4'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: '1.4'
|
83
83
|
description: Builds ActiveRecord outer joins from association paths and provides references
|
84
84
|
to table aliases.
|
85
85
|
email:
|
@@ -89,6 +89,7 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
@@ -126,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
127
|
- !ruby/object:Gem::Version
|
127
128
|
version: '0'
|
128
129
|
requirements: []
|
129
|
-
|
130
|
-
rubygems_version: 2.7.6
|
130
|
+
rubygems_version: 3.0.4
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Builds ActiveRecord joins from association paths
|