Skip to content
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

Conversation

@kamipo
Copy link
Member

@kamipo 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
Copy link

@rails-bot rails-bot commented Jun 20, 2016

r? @matthewd

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

@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch Jun 20, 2016
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch Jun 20, 2016
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch 2 times, most recently Aug 5, 2016
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch Aug 16, 2016
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch Sep 14, 2016
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch Oct 29, 2016
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch Dec 5, 2016
activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb Outdated
@@ -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

This comment has been minimized.

@kamipo

kamipo Dec 6, 2016
Author Member

Oh... thanks!

Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted
or updated because it would violate a not null constraint.
@kamipo kamipo force-pushed the kamipo:translate_not_null_violation_to_specific_exception branch to b270bc4 Dec 6, 2016
@sgrif sgrif merged commit cf6c294 into rails:master Dec 6, 2016
2 checks passed
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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.