Class: ActiveInteraction::Errors
- Inherits:
-
ActiveModel::Errors
- Object
- ActiveModel::Errors
- ActiveInteraction::Errors
- Defined in:
- lib/active_interaction/errors.rb
Overview
An extension that provides the ability to merge other errors into itself.
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
Returns the value of attribute backtrace.
Instance Method Summary collapse
- #local_attribute(attribute) ⇒ Object
-
#merge!(other) ⇒ Errors
Merge other errors into this one.
Instance Attribute Details
#backtrace ⇒ Object
Returns the value of attribute backtrace.
6 7 8 |
# File 'lib/active_interaction/errors.rb', line 6 def backtrace @backtrace end |
Instance Method Details
#local_attribute(attribute) ⇒ Object
28 29 30 |
# File 'lib/active_interaction/errors.rb', line 28 def local_attribute(attribute) attribute.to_s.sub(/\A([^.\[]*).*\z/, '\1').to_sym end |
#merge!(other) ⇒ Errors
Merge other errors into this one.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/active_interaction/errors.rb', line 13 def merge!(other) other..each do |attribute, | .zip(other.details[attribute]) do |, detail| if detailed_error?(detail) merge_detail!(attribute, detail, ) else (attribute, detail, ) end end end self end |