joiner 0.3.0 → 0.3.1
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/README.md +1 -1
- data/joiner.gemspec +1 -1
- data/lib/joiner/joins.rb +7 -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: 2429d80997714efe25b81996d815f4e0bfe12045
|
|
4
|
+
data.tar.gz: a1128c26224bf6d462de36cbe0466f23aac031e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f3d311940c4a63761a64332046f045bae0778b7b372add35646f1be5e42337d0c2cee8b151c5d11ad2285eb33a95e26d75096c6a7f7eb1e29127b52f9f34e58
|
|
7
|
+
data.tar.gz: 25f198394248d011a2c9bfdae297e5286b8ea26433a749e3b3302456221ee078ac2fcd0de20b9bfe87e9f0d59fa3d85be0d4a591e0275d23d2ca13e9084fcf87
|
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.3.
|
|
12
|
+
gem install joiner --version 0.3.1
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
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.3.
|
|
4
|
+
spec.version = '0.3.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}
|
data/lib/joiner/joins.rb
CHANGED
|
@@ -2,6 +2,7 @@ class Joiner::Joins
|
|
|
2
2
|
JoinDependency = ::ActiveRecord::Associations::JoinDependency
|
|
3
3
|
|
|
4
4
|
attr_reader :model
|
|
5
|
+
attr_writer :join_association_class
|
|
5
6
|
|
|
6
7
|
def initialize(model)
|
|
7
8
|
@model = model
|
|
@@ -18,6 +19,10 @@ class Joiner::Joins
|
|
|
18
19
|
add_join_to(path).aliased_table_name
|
|
19
20
|
end
|
|
20
21
|
|
|
22
|
+
def join_association_class
|
|
23
|
+
@join_association_class || JoinDependency::JoinAssociation
|
|
24
|
+
end
|
|
25
|
+
|
|
21
26
|
def join_values
|
|
22
27
|
@base
|
|
23
28
|
end
|
|
@@ -45,7 +50,8 @@ class Joiner::Joins
|
|
|
45
50
|
reflection = find_reflection(step, base_class)
|
|
46
51
|
reflection.check_validity!
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
join_association_class.new reflection,
|
|
54
|
+
[build_join_association(path[1..-1], reflection.klass)].compact
|
|
49
55
|
end
|
|
50
56
|
|
|
51
57
|
def find_join(path, base = nil)
|
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.3.
|
|
4
|
+
version: 0.3.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: 2014-
|
|
11
|
+
date: 2014-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
127
127
|
version: '0'
|
|
128
128
|
requirements: []
|
|
129
129
|
rubyforge_project:
|
|
130
|
-
rubygems_version: 2.
|
|
130
|
+
rubygems_version: 2.3.0
|
|
131
131
|
signing_key:
|
|
132
132
|
specification_version: 4
|
|
133
133
|
summary: Builds ActiveRecord joins from association paths
|