class
PgORM::Error::RecordInvalid
- PgORM::Error::RecordInvalid
- PgORM::Error
- Exception
- Reference
- Object
Overview
Raised when a record fails validation.
This exception includes the model instance and all validation errors.
Example
user = User.new(name: "")
begin
user.save!
rescue PgORM::Error::RecordInvalid => e
puts e.message # => "User has an invalid field. `name` can't be blank"
e.errors.each do |error|
puts "#{error[:field]}: #{error[:message]}"
end
end