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 ]
For migration, write
create_table :authorities do |t|
t.string 'value', :default => '', :null => false
Your email address will not be published. Required fields are marked *
Save my name, email, and website in this browser for the next time I comment.