ruby on rails - uninitialized constant ActionController::Rou



尝试在 Linux 服务器上部署应用程序时收到此错误。

Versão servidor: PostgreSQL 9.3.4 on x86_64-pc-linux-gnu, 编译者 x86_64-pc-linux-gnu-gcc (Gentoo 4.8.1-r1 p1.2, pie-0.5.7) 4.8.1, 64位

    uninitialized constant ActionController::Routing (NameError)
  /home/divulgapocos/apps_rails/divulgapocos/config/initializers/new_rails_defaults.rb:14:in `<top (required)>'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:651:in `load_config_initializer'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `each'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:210:in `block (2 levels) in each_strongly_connected_component_from'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:209:in `block in each_strongly_connected_component_from'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `each'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:44:in `tsort_each_child'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:203:in `each_strongly_connected_component_from'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
  /opt/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
  /home/divulgapocos/apps_rails/divulgapocos/config/environment.rb:5:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.6.1/lib/rack/builder.rb:55:in `instance_eval'
  /opt/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.6.1/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /opt/apx_passenger//helper-scripts/rack-preloader.rb:112:in `eval'
  /opt/apx_passenger//helper-scripts/rack-preloader.rb:112:in `preload_app'
  /opt/apx_passenger//helper-scripts/rack-preloader.rb:158:in `<module:App>'
  /opt/apx_passenger//helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /opt/apx_passenger//helper-scripts/rack-preloader.rb:28:in `<main>'

我的宝石文件看起来像这样

source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem "paperclip", "~> 4.2"
gem 'devise'
gem 'pg'
gem 'bootstrap-sass', '~> 3.3.4'
gem 'autoprefixer-rails'
gem 'masonry-rails', '~> 0.2.4'
gem 'devise-bootstrap-views'
gem 'paypal-recurring'
gem 'therubyracer'
gem 'activesupport'
gem 'railties'
gem 'rack'

group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

您已经从较旧的 2.x 版本的 Rails 更新了此应用程序。您的config/initializers/new_rails_defaults.rb中有一行使用ActionController::Routing常量,该常量在 Rails 4.2 中不再存在。

因此,基本上,这里的解决方法是将您的应用程序正确升级到 4.2。我可以告诉您从文件中删除ActionController::Routing行,但这可能只是您在此处尚未解决的许多其他问题之一。

奇怪的是,你没有提到在开发中遇到同样的问题,这表明你实际上并没有在开发中使用你认为的Rails版本。

祝你好运。

相关内容

  • 没有找到相关文章

最新更新