ruby on rails - RoR Enum "Unable to autoload constant" error -
i getting basic enum error in active admin:
unable autoload constant school_user
i have defined enums in model:
class schooluser < activerecord::base belongs_to :user has_one :school enum user_type: [:school, :student, :guardian, :teacher] end
and in admin/school_user.rb trying dropdown list:
activeadmin.register schooluser permit_params [:user_type] form |f| f.inputs "school_user" f.input :user_type, :as => :select, :collection => school_user::user_type.keys end f.actions end end
user_type integer.
i don't know i'm doing wrong here bet it's simple oversight. help?
unable autoload constant school_user
i believe error in below line
f.input :user_type, :as => :select, :collection => school_user::user_type.keys
where school_user
should schooluser
f.input :user_type, :as => :select, :collection => schooluser::user_types.keys
Comments
Post a Comment