【问题标题】:can't use db:seed in rails不能在 Rails 中使用 db:seed
【发布时间】:2010-03-27 22:48:20
【问题描述】:

我将我的 rails gem 更新到 2.3.5,但在运行 db:seed 时我不断收到此错误:

$ rake db:seed --trace
(in c:/Documents and Settings/Owner/workspace/thepatstudio)
rake aborted!
Don't know how to build task 'db:seed'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in `[]'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2050:in `invoke_task'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
c:/Ruby/bin/rake:19:in `load'
c:/Ruby/bin/rake:19

~/workspace/thepatstudio (master)
    $ rails --version
    Rails 2.3.5

我的 environment.rb 上有正确的 rails 版本,我还运行了 rake rails:update。我能做什么?

【问题讨论】:

  • 检查以确保您没有使用供应商版本的 Rails。你在使用版本控制吗?你不小心换了分支?我一直都在做这样的事情。
  • 您使用的是什么 ORM 和数据库?我发现这是我的 GemFile 中没有列出宝石的问题

标签: ruby-on-rails database seed


【解决方案1】:

您是否在更新 gem 后启动了 rake 任务来更新您的环境?

rake rails:update

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-12
    • 1970-01-01
    • 1970-01-01
    • 2017-10-18
    • 2011-02-08
    • 2016-02-09
    • 2016-03-11
    • 2019-01-05
    相关资源
    最近更新 更多