rom-sql 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/rom/sql/relation/reading.rb +2 -3
- data/lib/rom/sql/version.rb +1 -1
- data/spec/unit/relation/inner_join_spec.rb +15 -0
- 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: b4f8bdb0d753d19b5bb7be8f3d9282312f634e5d
|
4
|
+
data.tar.gz: dff2a952b88aa4457dc58adfc69a60e636a64527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 837cc9f183231b155420771c55408db56779aee6adb8d97c9ad378cbe82f4047774d93b764d064f5ecddfe3521081f02a91445d394ba6aa014e607382a69fd02
|
7
|
+
data.tar.gz: 20c1e14423d4113a1aef6d03bd68a2e1a41232b562891fbf53b01b7ffea185e27d15d902c5bd72734f30b330e515ad2e6a831831d990694dc6c3226aedf786da
|
data/CHANGELOG.md
CHANGED
@@ -809,15 +809,14 @@ module ROM
|
|
809
809
|
#
|
810
810
|
# @api private
|
811
811
|
def __join__(type, other, join_cond = EMPTY_HASH, opts = EMPTY_HASH, &block)
|
812
|
-
|
813
|
-
when Symbol, Association::Name
|
812
|
+
if other.is_a?(Symbol) || other.is_a?(Association::Name)
|
814
813
|
if join_cond.empty?
|
815
814
|
assoc = associations[other]
|
816
815
|
assoc.join(__registry__, type, self, __registry__[assoc.target.relation])
|
817
816
|
else
|
818
817
|
new(dataset.__send__(type, other.to_sym, join_cond, opts, &block))
|
819
818
|
end
|
820
|
-
|
819
|
+
elsif other.respond_to?(:name) && other.name.is_a?(Relation::Name)
|
821
820
|
associations[other.name.dataset].join(__registry__, type, self, other)
|
822
821
|
else
|
823
822
|
raise ArgumentError, "+other+ must be either a symbol or a relation, #{other.class} given"
|
data/lib/rom/sql/version.rb
CHANGED
@@ -103,6 +103,21 @@ RSpec.describe ROM::Relation, '#inner_join' do
|
|
103
103
|
])
|
104
104
|
end
|
105
105
|
|
106
|
+
let(:task_relation_proxy) { Class.new{ def name; ROM::Relation::Name.new(:tasks); end }.new }
|
107
|
+
|
108
|
+
it 'joins relation with relation proxy objects' do
|
109
|
+
result = relation.
|
110
|
+
inner_join(task_relation_proxy).
|
111
|
+
select(:name, tasks[:title])
|
112
|
+
|
113
|
+
expect(result.schema.map(&:name)).to eql(%i[name title])
|
114
|
+
|
115
|
+
expect(result.to_a).to eql([
|
116
|
+
{ name: 'Jane', title: "Jane's task" },
|
117
|
+
{ name: 'Joe', title: "Joe's task" }
|
118
|
+
])
|
119
|
+
end
|
120
|
+
|
106
121
|
it 'joins relation with join keys inferred for m:m-through' do
|
107
122
|
result = tasks.inner_join(tags)
|
108
123
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rom-sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -346,7 +346,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
346
346
|
version: '0'
|
347
347
|
requirements: []
|
348
348
|
rubyforge_project:
|
349
|
-
rubygems_version: 2.
|
349
|
+
rubygems_version: 2.5.2
|
350
350
|
signing_key:
|
351
351
|
specification_version: 4
|
352
352
|
summary: SQL databases support for ROM
|