The model User:
class User < ActiveRecord::Base
enum my_enum: [
:some_value1,
#....
]
Also I have a migration which adds my_enum
to User:
def change
add_column :users, :my_enum, :integer
end
And the fixture for FactoryGirl:
FactoryGirl.define do
factory :user do
email { Faker::Internet.email }
password { Faker::Internet.password(10) }
password_confirmation { password }
my_enum { nil }
end
end
Everything works fine. But when I run a test, I get an error:
Failure/Error: paid_user = FactoryGirl.create(:user)
ActiveModel::MissingAttributeError:
can't write unknown attribute `my_enum`