Ruby on rails 4 给出未定义方法“workers'”的轨道;对于主:对象(NoMethodError)

Ruby on rails 4 给出未定义方法“workers'”的轨道;对于主:对象(NoMethodError),ruby-on-rails-4,heroku,puma,Ruby On Rails 4,Heroku,Puma,我正在尝试在heroku上为rails应用程序设置puma。我正在关注如何做到这一点,但他们提供的配置文件似乎不起作用,我也不明白为什么。当我不使用任何配置文件时,它运行正常,但我希望能够指定它使用的工作进程和线程的数量 尝试运行服务器时,出现以下错误: C:/Users/Ephraim/Documents/lis/rails_app/config/initializers/puma.rb:1:in `<top (required)>': undefined method `work

我正在尝试在heroku上为rails应用程序设置puma。我正在关注如何做到这一点,但他们提供的配置文件似乎不起作用,我也不明白为什么。当我不使用任何配置文件时,它运行正常,但我希望能够指定它使用的工作进程和线程的数量

尝试运行服务器时,出现以下错误:

C:/Users/Ephraim/Documents/lis/rails_app/config/initializers/puma.rb:1:in `<top (required)>': undefined method `workers' for main:Object (NoMethodError)
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:652:in `block in load_config_initializer'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:651:in `load_config_initializer'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:615:in `each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/engine.rb:615:in `block in <class:Engine>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `tsort_each_child'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:411:in `call'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:345:in `each'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:345:in `call'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from C:/Ruby21-x64/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
from C:/Users/Ephraim/Documents/lis/rails_app/config/environment.rb:5:in `<top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from C:/Users/Ephraim/Documents/lis/rails_app/config.ru:3:in `block in <main>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from C:/Users/Ephraim/Documents/lis/rails_app/config.ru:in `new'
from C:/Users/Ephraim/Documents/lis/rails_app/config.ru:in `<main>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/server.rb:61:in `app'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/server.rb:139:in `log_to_stdout'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/server.rb:78:in `start'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from C:/Users/Ephraim/Documents/lis/rails_app/bin/rails:8:in `require'
from C:/Users/Ephraim/Documents/lis/rails_app/bin/rails:8:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'

什么会导致这种情况发生?如何修复它?

您需要使用foreman来运行
程序文件。这就是heroku开发应用程序的方式。一旦安装了
工头启动
,就应该这样做。这只是愚弄了我一下,我无意中发现了你的问题

从这里引用答案:

puma.rb
文件放入
config/
config/initializers/