web-dev-qa-db-ja.com

初期化されていない定数ActionDispatch :: Session :: EncryptedCookieStore(NameError)

私はRails 4 withpassenger。ちょうど今bundleを実行するまで、すべてがうまく機能していました。今、次のエラーが発生しています:

Web application could not be started

uninitialized constant ActionDispatch::Session::EncryptedCookieStore (NameError)
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application/configuration.rb:144:in `const_get'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application/configuration.rb:144:in `session_store'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application.rb:345:in `block in default_middleware_stack'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application.rb:307:in `tap'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application.rb:307:in `default_middleware_stack'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/engine.rb:494:in `app'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application/finisher.rb:34:in `block in <module:Finisher>'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/initializable.rb:30:in `instance_exec'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/initializable.rb:30:in `run'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/initializable.rb:55:in `block in run_initializers'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:180:in `each'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/2.0.0/tsort.rb:148:in `tsort_each'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/initializable.rb:54:in `run_initializers'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/application.rb:214:in `initialize!'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/Rails-2ac97df55230/railties/lib/Rails/railtie/configurable.rb:30:in `method_missing'
  /opt/ptolemy-web/config/environment.rb:5:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
  /u/sf/ytl/.rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /opt/rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/passenger-7ef605967703/helper-scripts/rack-preloader.rb:82:in `eval'
  /opt/rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/passenger-7ef605967703/helper-scripts/rack-preloader.rb:82:in `preload_app'
  /opt/rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/passenger-7ef605967703/helper-scripts/rack-preloader.rb:127:in `<module:App>'
  /opt/rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/passenger-7ef605967703/helper-scripts/rack-preloader.rb:6:in `<module:PhusionPassenger>'
  /opt/rbenv/versions/2.0.0-p0/lib/Ruby/gems/2.0.0/bundler/gems/passenger-7ef605967703/helper-scripts/rack-preloader.rb:5:in `<main>'

私のgemfile

source 'https://rubygems.org'

# Bundle Edge Rails instead: gem 'Rails', github: 'Rails/rails'
gem 'Rails', github: 'Rails/rails'

# database
gem 'pg'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-Rails',   github: 'Rails/sass-Rails'
  gem 'coffee-Rails', github: 'Rails/coffee-Rails'
  gem 'coffeebeans'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', platforms: :Ruby

  gem 'uglifier', '>= 1.0.3'
end

# UI
gem 'jquery-Rails'
gem 'less-Rails'
gem 'Twitter-bootstrap-Rails'
gem 'jquery-ui-Rails'
gem 'jquery-datatables-Rails', github: 'rweng/jquery-datatables-Rails'
gem 'backbone-on-Rails'
gem 'd3_Rails'
gem 'Rails-timeago'
gem 'dygraphs-Rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/Rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/Rails/jbuilder
gem 'jbuilder', '~> 1.0.1'

# To use ActiveModel has_secure_password
# gem 'bcrypt-Ruby', '~> 3.0.0'

# Use Unicorn as the app server
# gem 'Unicorn'

# Deploy with Capistrano
# gem 'capistrano', group: :development

# To use debugger
# gem 'debugger'

# UI middleware
gem 'passenger', github: 'FooBarWidget/passenger'
gem 'rack-webauth'

私のgoogle-fooはこの問題に関してかなり弱かった。誰か助けてもらえますか?

35
yee379

シークレットCookieストアは最近Rails 4で削除されました。 Changelog を参照してください。

アプリを再び機能させるには、config/initializers /session_store.rbの行config.session_store :encrypted_cookie_storeconfig.session_store :cookie_storeに置き換えます。ストアは自動的に暗号化されます。

わからない場合。新しいRails 4アプリ(Rails new app_name --pre)を作成し、イニシャライザーを確認します。

詳細については、 コミットによる を参照してください。

104
leifg