hanami-model 1.2.0.beta2 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/hanami-model.gemspec +1 -1
- data/lib/hanami/model/error.rb +6 -0
- data/lib/hanami/model/mapped_relation.rb +26 -0
- data/lib/hanami/model/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 686f2bdfbd1a3d690fe52263f7bcde2966761bfab7309c99543c91429206c1d5
|
4
|
+
data.tar.gz: 1769c202b73a2131705ee7e4f52b3296f7a5769f6311fef139880b66733f90d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a35334766fe5e0c6aee8e49657e7559aef608b17a496605a7363e839fa3e7c99626616bdb9d963a89f310b8bdf03c59c92400d98987b0b65ea877620c7b36d2
|
7
|
+
data.tar.gz: 103f13b9e25a9ad7325da52a0ddb1ef0d1c041aa2f94aa9f229fa3f4971c8d6a3a4643a93906485bec1bd0dc32d8461c8ea5b759d4691271ef5a6870cbdacd9d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Hanami::Model
|
2
2
|
A persistence layer for Hanami
|
3
3
|
|
4
|
+
## v1.2.0.rc1 - 2018-03-30
|
5
|
+
### Fixed
|
6
|
+
- [Marcello Rocha & Luca Guidi] Ensure repository relations to access database attributes via `#[]` (eg. `projects[:name].ilike("Hanami")`)
|
7
|
+
|
4
8
|
## v1.2.0.beta2 - 2018-03-23
|
5
9
|
|
6
10
|
## v1.2.0.beta1 - 2018-02-28
|
data/README.md
CHANGED
data/hanami-model.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
spec.required_ruby_version = '>= 2.3.0'
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'hanami-utils', '1.2.0.
|
21
|
+
spec.add_runtime_dependency 'hanami-utils', '1.2.0.rc1'
|
22
22
|
spec.add_runtime_dependency 'rom', '~> 3.3', '>= 3.3.3'
|
23
23
|
spec.add_runtime_dependency 'rom-sql', '~> 1.3', '>= 1.3.5'
|
24
24
|
spec.add_runtime_dependency 'rom-repository', '~> 1.4'
|
data/lib/hanami/model/error.rb
CHANGED
@@ -26,8 +26,34 @@ module Hanami
|
|
26
26
|
# @since 1.0.0
|
27
27
|
# @api private
|
28
28
|
def initialize(relation)
|
29
|
+
@relation = relation
|
29
30
|
super(relation.as(self.class.mapper_name))
|
30
31
|
end
|
32
|
+
|
33
|
+
# Access low level relation's attribute
|
34
|
+
#
|
35
|
+
# @param attribute [Symbol] the attribute name
|
36
|
+
#
|
37
|
+
# @return [ROM::SQL::Attribute] the attribute
|
38
|
+
#
|
39
|
+
# @raises [Hanami::Model::UnknownAttributeError] if the attribute cannot be found
|
40
|
+
#
|
41
|
+
# @since 1.2.0
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# class UserRepository < Hanami::Repository
|
45
|
+
# def by_matching_name(name)
|
46
|
+
# users
|
47
|
+
# .where(users[:name].ilike(name))
|
48
|
+
# .map_to(User)
|
49
|
+
# .to_a
|
50
|
+
# end
|
51
|
+
# end
|
52
|
+
def [](attribute)
|
53
|
+
@relation[attribute]
|
54
|
+
rescue KeyError => e
|
55
|
+
raise UnknownAttributeError.new(e.message)
|
56
|
+
end
|
31
57
|
end
|
32
58
|
end
|
33
59
|
end
|
data/lib/hanami/model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.0.
|
4
|
+
version: 1.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-utils
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2.0.
|
19
|
+
version: 1.2.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.2.0.
|
26
|
+
version: 1.2.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rom
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|