-
-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate enum column is an integer in
define_enum_for
If your ActiveRecord model stores its `enum` data in a non-integer column, ActiveRecord will save the data without error. However, when you access the attribute on the record after saving, AR will look for the string to what it expects to be a list of numbers and return `nil` rather than the mapped value. This change adds a third criterion to the `define_enum_for` matcher, verifying that the underlying database column has a `sql_type` of `"integer"`. Fix #827.
- Loading branch information
1 parent
0e9c48e
commit ab347d4
Showing
2 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters