我使用ruby 1.9.2和rails 3.0.9。db:種子拋出一個錯誤
每當我試圖執行耙分貝:種子,它拋出以下錯誤:
rake aborted!
uninitialized constant EmployeeCategory
我已經禁用線程並啓用了「在配置/ application.rb中文件dependency_loading。
config.threadsafe! unless $rails_rake_task
config.dependency_loading = true
但它仍然無法正常工作。
這裏的seed.rb文件
StudentCategory.destroy_all
StudentCategory.create([
{:name=>"OBC",:is_deleted=>false},
{:name=>"General",:is_deleted=>false}
])
EmployeeCategory.create([
{:name => 'Management',:prefix => 'MGMT',:status => true},
{:name => 'Teaching',:prefix => 'TCR',:status => true},
{:name => 'Fedena Admin',:prefix => 'Admin',:status => true},
{:name => 'Non-Teaching',:prefix => 'NTCR',:status => true}
])
EmployeePosition.create([
{:name => 'Principal',:employee_category_id => 2,:status => true},
{:name => 'Jr.Teacher',:employee_category_id => 3,:status => true},
{:name => 'Clerk',:employee_category_id => 4,:status => true}
])
請問您的應用程序是否可以在rails s上正常運行? – Dogbert
向我們展示seed.rb包含 –
rails在我的工作站上運行的文件。 – CodeMaster123