Introduction
Enum - is a user-defined data type representing a set of named values. In general, the idea of enums aims to provide 2 mai...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks for sharing this knowledge!
I noticed a mistake on the migration:
Every value is 0, I think it should be 0, 1 and 2.
Nice post @dsalahutdinov , apart from what @antico5 says I see another detail here, is that the last one should be
instead of
@johand , thanks, fixed
unfortunately the db/schema.rb file is messed up with this approach
Could not dump table "users" because of following StandardError
Unknown type 'xyz_setting' for column 'xyz'
stackoverflow.com/questions/646689...
Hi! Good point. To have the "native" schema.rb support of postgres enum you could use this ruby gem github.com/bibendi/activerecord-po...
Another approach: jetrockets.pro/blog/ruby-string-li...
Michael, thanks for your comment!
This is great idea, which comes after the fail without having explicit values first :)
thanx for sharing! should be remove_column instead of drop_column in migration.
Thanks for the article. I was already looking to Postgres Enums for a solution to my data validation and now you've given me the path to my proposed solution. Happy days.