2016-08-14 60 views
0

我很难运行rails runner(在rails 4.2.6版本中)。rails runner引发不正确的错误:“config.eager_load设置为零”

即使在所有环境文件中正确设置此值,以下每个命令都会将错误“config.eager_load设置为零”。

bin/rails runner -e "MyClass.my_method" 
bundle exec rails runner =e "MyClass.my_method" 

bin/rails runner -e "MyClass.my_method" RAILS_ENV=development 
bundle exec rails runner =e "MyClass.my_method" RAILS_ENV=development 

RAILS_ENV=development bin/rails runner -e "MyClass.my_method" 
RAILS_ENV=development bundle exec rails runner -e "MyClass.my_method" 

什么是运行rails runner的正确方法?

+1

下面是关于运行'runner'的正确方法的文档:http://guides.rubyonrails.org/command_line.html#rails-runner这意味着它可能是'bin/rails runner -e development“MyClass .my_method“' –

+1

哇。文档。谢谢。帖子,我会标记为答案。 – s2t2

回答

1

下面是关于运行亚军有道文档:http://guides.rubyonrails.org/command_line.html#rails-runner,这意味着它可能是

bin/rails runner -e development "MyClass.my_method" 

注:我总是推荐阅读完所有的Rails的指南,如果您还没有 - 他们是一个最好的方法来升级Rails。 :)