Method: PureValidator::ValidationErrors#to_hash
- Defined in:
- lib/pure_validator/validation_errors.rb
#to_hash(full_messages = false) ⇒ Object
Returns a Hash of attributes with their error messages. If full_messages is true, it will contain full messages (see full_message).
errors.to_hash # => {:name=>["can not be nil"]}
errors.to_hash(true) # => {:name=>["name can not be nil"]}
154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/pure_validator/validation_errors.rb', line 154 def to_hash( = false) if = {} self..each do |attribute, array| [attribute] = array.map { || (attribute, ) } end else self..dup end end |