Class: Hanami::Action::Params::Errors
- Defined in:
- gems/gems/hanami-controller-2.1.0/lib/hanami/action/params.rb
Overview
Params errors
Instance Method Summary collapse
-
#add(*args) ⇒ Object
Add an error to the param validations.
Instance Method Details
#add(*args) ⇒ Object
Add an error to the param validations
This has a semantic similar to Hash#dig
where you use a set of keys to get a nested value, here you use a set of keys to set a nested value.
Source: | on GitHub
def add(*args) *keys, key, error = args _nested_attribute(keys, key) << error rescue TypeError raise ArgumentError.new("Can't add #{args.map(&:inspect).join(', ')} to #{inspect}") end |