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

r? @matthewd

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

@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch from f115ed0 to 26b7cb5 Compare June 20, 2016 16:33
@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch from 26b7cb5 to b2af501 Compare June 20, 2016 18:39
@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch 2 times, most recently from 1853221 to da236ee Compare August 6, 2016 23:55
@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch from da236ee to 818f8e1 Compare August 16, 2016 13:41
@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch from 818f8e1 to ea91a50 Compare September 14, 2016 10:01
@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch from ea91a50 to 3b24a28 Compare October 29, 2016 07:37
@kamipo kamipo force-pushed the translate_not_null_violation_to_specific_exception branch from 3b24a28 to c610bb6 Compare December 5, 2016 22:17
@@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEFUALT => DEFAULT

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 translate_not_null_violation_to_specific_exception branch from c610bb6 to b270bc4 Compare December 6, 2016 07:53
@sgrif sgrif merged commit cf6c294 into rails:master Dec 6, 2016
@kamipo kamipo deleted the translate_not_null_violation_to_specific_exception branch December 6, 2016 12:22
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
Development

Successfully merging this pull request may close these issues.

None yet

6 participants