You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TLDR: A configuration option to cause Enumerize to raise an error when a record with an invalid enumerized attribute would be very helpful!
Hello! My team and I were recently investigating an issue that turned out to be due to the way Enumerize behaves with database records with an invalid value. For example, we have a database table with a string column, example, with enumerized values being ['foo', 'bar', 'baz']. We had some records where example was set to baw. We then made an ActiveRecord query:
This was caused by a data migration we ran on this table before adding the enumerize keyword to the model. The data migration populated records in the database with a value we didn't realize at the time was invalid. So once we added Enumerize to the model, we introduced a bug that causes the behavior to break silently.
It would be really cool if there was a configuration option that causes Enumerize to raise an error when fetching a record which has an invalid value for an enumerized attribute. It probably makes the most sense to default it to false to preserve current behavior, but I'd leave that up to the implementer.
Thanks for your consideration!
The text was updated successfully, but these errors were encountered:
TLDR: A configuration option to cause Enumerize to raise an error when a record with an invalid
enumerized
attribute would be very helpful!Hello! My team and I were recently investigating an issue that turned out to be due to the way Enumerize behaves with database records with an invalid value. For example, we have a database table with a
string
column,example
, with enumerized values being['foo', 'bar', 'baz']
. We had some records whereexample
was set tobaw
. We then made an ActiveRecord query:This was caused by a data migration we ran on this table before adding the
enumerize
keyword to the model. The data migration populated records in the database with a value we didn't realize at the time was invalid. So once we added Enumerize to the model, we introduced a bug that causes the behavior to break silently.It would be really cool if there was a configuration option that causes Enumerize to raise an error when fetching a record which has an invalid value for an
enumerized
attribute. It probably makes the most sense to default it tofalse
to preserve current behavior, but I'd leave that up to the implementer.Thanks for your consideration!
The text was updated successfully, but these errors were encountered: