DB:种子不装车型 [英] db:seed not loading models

查看:173
本文介绍了DB:种子不装车型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的种子与标准 DB / seeds.rb 方法的数据库。这工作得很好我的开发机,但我的服务器上,我得到:

I'm trying to seed my database with the standard db/seeds.rb method. This works fine on my development machine, but on my server, I get:

$ 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'
...

但是,当我检查的控制台,该模型是存在的:

But when I check in the console, the model does exist:

$ script/console production
Loading production environment (Rails 2.3.4)
>> Permission
=> Permission(id: integer, ..., created_at: datetime, updated_at: datetime)

我是什么忘了?

What am I forgetting?

推荐答案

可以在环境配置固定通过禁用线程安全的!

It can be fixed by disabling threadsafe! in the environment configuration.

这篇关于DB:种子不装车型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆