Method: PureValidator::ValidationErrors#full_messages_for
- Defined in:
- lib/pure_validator/validation_errors.rb
#full_messages_for(attribute) ⇒ Object
Returns all the full error messages for a given attribute in an array.
class PersonValidator
validates :name, :address, :email, presence: true
validates :name, length: { min: 5, max: 30 }
end
= create()
errors.(:name)
# => ["Name is too short (minimum is 5 characters)", "Name can't be blank"]
227 228 229 |
# File 'lib/pure_validator/validation_errors.rb', line 227 def (attribute) (get(attribute) || []).map { || (attribute, ) } end |