【发布时间】:2011-01-13 09:06:21
【问题描述】:
我正在尝试使用标准的db/seeds.rb 方法为我的数据库播种。这在我的开发机器上运行良好,但在我的服务器上,我得到:
$ sudo rake db:seed RAILS_ENV=production --trace
** Invoke db:seed (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:seed
rake aborted!
uninitialized constant Permission
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:92:in `const_missing'
/path/.../.../.../.../db/seeds.rb:4
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/tasks/databases.rake:215:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/tasks/databases.rake:215
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
...
但是当我在控制台检查时,模型确实存在:
$ script/console production
Loading production environment (Rails 2.3.4)
>> Permission
=> Permission(id: integer, ..., created_at: datetime, updated_at: datetime)
我忘记了什么?
【问题讨论】:
-
请注意,它在我的生产服务器上的开发环境中可以正常工作。
-
你的seeds.rb是什么样子的?
-
我修好了。我禁用了
threadsafe!。 -
请添加您的答案并将其标记为已回答。
标签: mysql ruby-on-rails activerecord rake