Upon finding a failed validation, invalid? will return false and exit. If all validations pass, invalid? will return true and the code will continue. Does the rescue code only run if all validations pass? If so, what raised errors will it catch? Lastly why is there no Begin?
def save
return false if invalid? # invalid? triggers validations
true
rescue ActiveRecord::StatementInvalid => e
# Handle exception that caused the transaction to fail
# e.message and e.cause.message can be helpful
errors.add(:base, e.message)
false
end