rom-sql 1.2.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef99832857b3fd2134904b5c5cd99d33ad1665d8
4
- data.tar.gz: 5a08cac386afc1d218d51a19d5d2a2167cb617d7
3
+ metadata.gz: b4f8bdb0d753d19b5bb7be8f3d9282312f634e5d
4
+ data.tar.gz: dff2a952b88aa4457dc58adfc69a60e636a64527
5
5
  SHA512:
6
- metadata.gz: 712552863d0d9a5cb8c4ce14557ed8705bc274bddff9c9c3b613379a93f470aac04fa5eddce7d133ad1ffe9bd024d05bb08cd052babf7a158cf0da320cbf55d3
7
- data.tar.gz: a0baf07fda4b9eb66fa0e296a39e2f1d7ed641db3fe3f9feaacf4d2ad8a2b587902c4f335115fa3edd662c5e0aca818bc3140528591a2eeb9b12b2e602bfa3a1
6
+ metadata.gz: 837cc9f183231b155420771c55408db56779aee6adb8d97c9ad378cbe82f4047774d93b764d064f5ecddfe3521081f02a91445d394ba6aa014e607382a69fd02
7
+ data.tar.gz: 20c1e14423d4113a1aef6d03bd68a2e1a41232b562891fbf53b01b7ffea185e27d15d902c5bd72734f30b330e515ad2e6a831831d990694dc6c3226aedf786da
@@ -1,3 +1,11 @@
1
+ ## v1.2.1 2017-03-09
2
+
3
+ ### Fixed
4
+
5
+ * Allow for joining by a `RelationProxy` instance from `rom-repository` (davydovanton)
6
+
7
+ [Compare v1.2.0...v1.2.1](https://github.com/rom-rb/rom-sql/compare/v1.2.0...v1.2.1)
8
+
1
9
  ## v1.2.0 2017-03-07
2
10
 
3
11
  ### Added
@@ -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
- case other
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
- when Relation
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"
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module SQL
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.2.1'.freeze
4
4
  end
5
5
  end
@@ -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.0
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-07 00:00:00.000000000 Z
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.6.9
349
+ rubygems_version: 2.5.2
350
350
  signing_key:
351
351
  specification_version: 4
352
352
  summary: SQL databases support for ROM