rake aborted! uninitialized constant Object::Count

2020-04-08 13:13发布

问题:

I have rails 3.1, I am trying to populate data with seeds.rb I have a model Country which is migrated into a countries table

But it seems that rails can't see Country model from seeds.rb I get this error:

rake aborted!
uninitialized constant Object::Country

Tasks: TOP => db:seed

my seeds.rb file looks like this:

# encoding: UTF-8

Country.delete_all

my Country model:

class Country < ActiveRecord::Base
  has_many :students
  has_many :instructors

end

any idea please ?

EDIT

I am in development environment, with config.threadsafe!