rom-sql 1.1.0 → 1.1.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/CHANGELOG.md +8 -0
- data/lib/rom/sql/relation/reading.rb +2 -1
- data/lib/rom/sql/version.rb +1 -1
- data/spec/unit/relation/where_spec.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d5df789d515ed4a587a6e320675b552b87f656e
|
4
|
+
data.tar.gz: e450e586c6bb7e47760bf3a714277aa1fafa62c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271a9fb3be58c1e78bd9b1cefd4fc503924a8685519006ef5f88fc8ed08979a42acf3011a2fc4fd4d3603308de9910f2872860404d3a573bafc35c61cb7a326a
|
7
|
+
data.tar.gz: 41289e5734f4350c9b268248ced4d68ecd6dd33fbc5489f6d802fcfb2736d291d00bedf7164787b7e0629e101af895ece5bf6d6b84352ca5e963b0af1ae84522
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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
|
data/lib/rom/sql/version.rb
CHANGED
@@ -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
|
|