caprese 0.3.11 → 0.3.12

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: 0a9e6756d45e03f3c91b1c6481aec5b57032a103
4
- data.tar.gz: 70d8e1b6c043dab986369ac84c3cf2912a44700d
3
+ metadata.gz: 0802a72a6fea0cdf81ac59f8642e41311eec6fe2
4
+ data.tar.gz: 095bf0cebda59ca5853e0bdf2376725a39220cbe
5
5
  SHA512:
6
- metadata.gz: 1c144ac674470aeeabecd13910a0ec0ec3cd6ce2a3621c7c2eccc75783aeceb9f2996b2dff1b85e42ba5155db19b39307214a647a0c834a58df0edd3e3ff95a4
7
- data.tar.gz: dd3a0c1156512e15efd759a8cc03d8d76695ff9db17a3098884939c6c42578f5cea864436a2edad6e7bb2dca46038be85d378b7dc92988e8fd91880e2ad5de84
6
+ metadata.gz: 4ce5e1ffef8d695e65b69973be4a078364a29a8af8f801e087fd7287714c5ea89f01a7ac594a57923a4527fd84a6086af72f4b03e66cc1dd67fd9f7df83cf66b
7
+ data.tar.gz: d89cf6f8f61b18c9e483b4b776f26bc5d67f9decc06f7f334c62a5989519fb3d08d42a1a2f365aee7115c2eea3374039e57eb40350b744ad0c325ae188c2edb1
data/CHANGELOG.md CHANGED
@@ -63,3 +63,7 @@
63
63
  ## 0.3.11
64
64
 
65
65
  * Allow `record_scope` and `relationship_scope` to return `[]`
66
+
67
+ ## 0.3.12
68
+
69
+ * Refactor RecordNotFoundError and AssociationNotFoundError to use separate `parameter` translations
@@ -116,7 +116,6 @@ module Caprese
116
116
  scope.find_by!(column => value) unless scope.is_a?(Array) && scope.empty?
117
117
  rescue ActiveRecord::RecordNotFound => e
118
118
  fail RecordNotFoundError.new(
119
- field: column,
120
119
  model: scope.name.underscore,
121
120
  value: value
122
121
  )
@@ -24,10 +24,14 @@ module Caprese
24
24
  # @param [String] model the name of the model we searched for a record of
25
25
  # @param [Value] value the value we searched for a match with
26
26
  class RecordNotFoundError < Error
27
- def initialize(field: :id, model: nil, value: nil)
28
- super field: field, code: :not_found, t: { model: model, value: value }
27
+ def initialize(model: nil, value: nil)
28
+ super field: :id, code: :not_found, t: { model: model, value: value }
29
29
  @header = { status: :not_found }
30
30
  end
31
+
32
+ def full_message
33
+ I18n.t("#{i18n_scope}.parameters.not_found", t)
34
+ end
31
35
  end
32
36
 
33
37
  # Thrown when an association was not found when calling `record.association()`
@@ -35,9 +39,13 @@ module Caprese
35
39
  # @param [String] name the name of the association
36
40
  class AssociationNotFoundError < Error
37
41
  def initialize(name)
38
- super field: name, code: :association_not_found
42
+ super field: :name, code: :not_found, t: { model: 'relationship', value: name }
39
43
  @header = { status: :not_found }
40
44
  end
45
+
46
+ def full_message
47
+ I18n.t("#{i18n_scope}.parameters.not_found", t)
48
+ end
41
49
  end
42
50
 
43
51
  # Thrown when an action that is forbidden was attempted
@@ -1,3 +1,3 @@
1
1
  module Caprese
2
- VERSION = '0.3.11'
2
+ VERSION = '0.3.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caprese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Landgrebe
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-02-21 00:00:00.000000000 Z
13
+ date: 2017-02-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_model_serializers