destination_errors 0.0.3 → 0.0.4
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/lib/destination_errors.rb +10 -8
- data/lib/destination_errors/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b0d1e913a5dd6b4ff6879838460b50edea24bb7
|
4
|
+
data.tar.gz: cba1186d7b96cefa43087297341d7e2a9928166a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 199dc1f6c651a7f302a45b13bee6c9fd73f8b5ab69756b85baa7e846b8be369614b356d4e95ed56d0328b04d98c606341e6fbe85fe3b060aead713ffdec49654
|
7
|
+
data.tar.gz: e5f9fe80bfab3483c03604be00b8be04ee5e321448a534a3d6f776bfa9456374d2f7510ebc9bb3f13ec1ca1cf0ec38fbfb7ebbfcfc2081ce8af78d97656d0749
|
data/lib/destination_errors.rb
CHANGED
@@ -113,13 +113,13 @@ module DestinationErrors
|
|
113
113
|
end
|
114
114
|
|
115
115
|
def move_errors_from_surface_to_destination_if_needed(surface)
|
116
|
-
if move_errors_from_surface?(surface)
|
116
|
+
if move_errors_from_surface?(surface) && error_destination
|
117
117
|
(
|
118
118
|
surface.nil? ?
|
119
|
-
errors.
|
120
|
-
self.send(surface).errors.
|
121
|
-
).each do |message|
|
122
|
-
move_error_to_destination(message)
|
119
|
+
errors.messages :
|
120
|
+
self.send(surface).errors.messages
|
121
|
+
).each do |key, message|
|
122
|
+
move_error_to_destination(key, message)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -146,9 +146,11 @@ module DestinationErrors
|
|
146
146
|
surface_errors_on.nil? || !self.send(surface_errors_on)
|
147
147
|
end
|
148
148
|
|
149
|
-
def move_error_to_destination(message)
|
150
|
-
if error_destination
|
151
|
-
error_destination.errors.add(
|
149
|
+
def move_error_to_destination(key, message)
|
150
|
+
if error_destination.respond_to?(key)
|
151
|
+
error_destination.errors.add(key, *message)
|
152
|
+
else
|
153
|
+
error_destination.errors.add(:base, *message)
|
152
154
|
end
|
153
155
|
end
|
154
156
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: destination_errors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|