April 30, 2014

Enum column in Rails

Declare an enum attribute where the values map to integers in the database, but can be queried by name. Example: class User < ActiveRecord::Base enum status: [ :admin, :user, :banned ] end  For migration, write  def up create_table :authorities do […]
get in touch
gdpr-image
This website uses cookies to provide necessary website functionality, improve your experience and analyze our traffic. By using our website, you agree to our Privacy Policy and our cookies usage.
READ MORE