LoadError:无法加载此类文件--ffaker

时间:2016-02-15 07:18:29

标签: ruby-on-rails heroku

请原谅我的无知。我有问题在heroku上搜索我的数据库。我跑的时候:

heroku run rake db:migrate

我得到了

rake aborted!
LoadError: cannot load such file -- ffaker
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:247:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:247:in `block in require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:232:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:247:in `require'
/app/lib/tasks/seed.rake:1:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:241:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:241:in `block in load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:232:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.1.7/lib/active_support/depend
encies.rb:241:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:654:in `bl
ock in run_tasks_blocks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:654:in `ea
ch'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:654:in `ru
n_tasks_blocks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/application.rb:384:i
n `run_tasks_blocks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/engine.rb:449:in `lo
ad_tasks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/railtie.rb:194:in `p
ublic_send'
/app/vendor/bundle/ruby/1.9.1/gems/railties-4.1.7/lib/rails/railtie.rb:194:in `m
ethod_missing'
/app/Rakefile:6:in `<top (required)>'
(See full trace by running task with --trace)

我尝试过heroku rake db:migrate > no such file to load -- faker的解决方案但没有运气。我真的不确定从这里可以去哪里。我非常感谢任何帮助。感谢。

3 个答案:

答案 0 :(得分:1)

您应该在代码中指定:

require 'ffaker'

答案 1 :(得分:0)

此外,请确保您在正确的宝石组中有ffaker。我正在设置一个临时环境,并且想要加载虚拟数据,忘记了ffaker只在开发和测试环境组中。

答案 2 :(得分:0)

我正在使用git URL在我的Gemfile中添加ffaker。我删除了该URL,再次运行bundle,现在一切正常。

-  gem 'ffaker', '~>2.10.0', git: 'https://github.com/ffaker/ffaker.git'
+  gem 'ffaker', '~>2.10.0'