Postgres enums in Ruby on Rails - CreatorPlatform.xyz - Part 5
Postgres enums in Ruby on Rails. Using the create_enum method in a Rails migration, we can create a new Enum datatype in postgres that we can use from our models. We'll also talk about several enum configurations for enabling prefixes or suffixes and disabling scopes that are automatically generated for you.
00:00 Introduction
00:24 Generate a new Event model
01:21 Create enum datatype in Rails migration
02:24 Review enums in postgresql database
03:24 Set up enums in Active Record model
06:05 Conclusion
Playlist: https://www.youtube.com/playlist?list=PLS6F722u-R6IJfBrIRx3a2SBkAL4vUp2p
Code: https://github.com/cjavdev/creators.dev/
Documentation: https://api.rubyonrails.org/v5.2.4.4/classes/ActiveRecord/Enum.html
Follow me on Twitter: http://twitter.com/cjav_dev
#rubyonrails #ruby #rails