New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate NOT NULL violation to the specific exception #25451

Merged
merged 1 commit into from Dec 6, 2016

Conversation

Projects
None yet
6 participants
@kamipo
Member

kamipo commented Jun 20, 2016

Raise ActiveRecord::NotNullViolation when a record cannot be inserted
or updated because it would violate a not null constraint.

@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Jun 20, 2016

r? @matthewd

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented Jun 20, 2016

r? @matthewd

(@rails-bot has picked a reviewer for you, use r? to override)

Show outdated Hide outdated ...verecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -733,6 +733,8 @@ def add_options_for_index_columns(quoted_columns, **options)
# See https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html
ER_DUP_ENTRY = 1062
ER_NOT_NULL_VIOLATION = 1048
ER_DO_NOT_HAVE_DEFUALT = 1364

This comment has been minimized.

@alepore

alepore Dec 6, 2016

DEFUALT => DEFAULT

@alepore

alepore Dec 6, 2016

DEFUALT => DEFAULT

This comment has been minimized.

@kamipo

kamipo Dec 6, 2016

Member

Oh... thanks!

@kamipo

kamipo Dec 6, 2016

Member

Oh... thanks!

Translate NOT NULL violation to the specific exception
Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted
or updated because it would violate a not null constraint.

@sgrif sgrif merged commit cf6c294 into rails:master Dec 6, 2016

2 checks passed

codeclimate Code Climate didn't find any new or fixed issues.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kamipo kamipo deleted the kamipo:translate_not_null_violation_to_specific_exception branch Dec 6, 2016

kamipo added a commit to kamipo/rails that referenced this pull request Dec 9, 2016

matthewd added a commit that referenced this pull request Dec 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment