I am just starting out with Rails and decided to make a small application to learn something practical.
I have a custom class that has an integer field of a user group. I want to add a: a default value to the migration using a constant.
In my user model, I defined different groups with constants, so that later I can easily check "admin"? etc.
t.integer :user_group, :default => USER
I get the following error on db: migrate
rake is interrupted! Expected [...] / app / models / user.rb to determine USER
However, in the user model, I have this:
ADMIN = 1 USER = 2
Any ideas what I'm doing wrong?
ruby-on-rails
zbrox
source share