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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -