Class: Reform::Contract::Errors
- Inherits:
-
ActiveModel::Errors
- Object
- ActiveModel::Errors
- Reform::Contract::Errors
- Defined in:
- lib/reform/form/active_model/errors.rb
Overview
The Errors class is planned to replace AM::Errors. It provides proper nested error messages.
Instance Method Summary collapse
- #merge!(errors, prefix) ⇒ Object
- #to_s ⇒ Object
-
#valid? ⇒ Boolean
TODO: test me in unit test.
Instance Method Details
#merge!(errors, prefix) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/reform/form/active_model/errors.rb', line 3 def merge!(errors, prefix) errors..each do |field, msgs| unless field.to_sym == :base field = (prefix+[field]).join(".").to_sym # TODO: why is that a symbol in Rails? end msgs.each do |msg| next if [field] and [field].include?(msg) add(field, msg) end # Forms now contains a plain errors hash. the errors for each item are still available in item.errors. end end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/reform/form/active_model/errors.rb', line 20 def to_s .inspect end |
#valid? ⇒ Boolean
TODO: test me in unit test.
16 17 18 |
# File 'lib/reform/form/active_model/errors.rb', line 16 def valid? # TODO: test me in unit test. empty? end |