rom-sql 1.1.0 → 1.1.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
  SHA1:
3
- metadata.gz: d4ee8c56fc0c1b34efb44c1d32c844765bc6c891
4
- data.tar.gz: a2aeb62deb514cc3912f5fd512c9c02e2c9a24df
3
+ metadata.gz: 8d5df789d515ed4a587a6e320675b552b87f656e
4
+ data.tar.gz: e450e586c6bb7e47760bf3a714277aa1fafa62c4
5
5
  SHA512:
6
- metadata.gz: '0942e1aeec2211371d871e1510f2668187581abcd5f4cbe447f2666a125678c4392c4e39fd0e8ceaecae227562d691b3ef8ab715a9ef111ed1ebb260ba5d64d4'
7
- data.tar.gz: 3f08eac6477071a28cabb927690eaef0a0db41ee1bba0804f01a45e5317f5ba882765a06001313bed14309c8c169198071b45f07e8e22579a7956db669a0bf32
6
+ metadata.gz: 271a9fb3be58c1e78bd9b1cefd4fc503924a8685519006ef5f88fc8ed08979a42acf3011a2fc4fd4d3603308de9910f2872860404d3a573bafc35c61cb7a326a
7
+ data.tar.gz: 41289e5734f4350c9b268248ced4d68ecd6dd33fbc5489f6d802fcfb2736d291d00bedf7164787b7e0629e101af895ece5bf6d6b84352ca5e963b0af1ae84522
@@ -1,3 +1,11 @@
1
+ ## v1.1.1 2017-03-01
2
+
3
+ ### Fixed
4
+
5
+ * Restriction conditions with an array as a value are handled correctly by attribute types (solnic)
6
+
7
+ [Compare v1.1.0...v1.1.1](https://github.com/rom-rb/rom-sql/compare/v1.1.0...v1.1.1)
8
+
1
9
  ## v1.1.0 2017-03-01
2
10
 
3
11
  ### Added
@@ -797,7 +797,8 @@ module ROM
797
797
  def coerce_conditions(conditions)
798
798
  conditions.each_with_object({}) { |(k, v), h|
799
799
  if k.is_a?(Symbol) && self.class.schema.key?(k)
800
- h[k] = self.class.schema[k][v]
800
+ type = self.class.schema[k]
801
+ h[k] = v.is_a?(Array) ? v.map { |e| type[e] } : type[v]
801
802
  else
802
803
  h[k] = v
803
804
  end
@@ -1,5 +1,5 @@
1
1
  module ROM
2
2
  module SQL
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.1.1'.freeze
4
4
  end
5
5
  end
@@ -82,6 +82,17 @@ RSpec.describe ROM::Relation, '#where' do
82
82
  to eql(id: 2, user_id: 1, title: "Jane's task")
83
83
  end
84
84
 
85
+ it 'applies write_schema to hash conditions where value is an array' do
86
+ ids = %w(1 2).map(&Test::Id.method(:new))
87
+ rel = tasks.where(id: ids)
88
+
89
+ expect(rel.to_a).
90
+ to eql([
91
+ { id: 1, user_id: 2, title: "Joe's task" },
92
+ { id: 2, user_id: 1, title: "Jane's task" }
93
+ ])
94
+ end
95
+
85
96
  it 'applies write_schema to conditions with operators other than equality' do
86
97
  rel = tasks.where { id >= Test::Id.new('2') }
87
98
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rom-sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica