diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index 71c541b4..bf2b8406 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -262,3 +262,16 @@ module Sidekiq end end end + +if defined?(::ActionDispatch::Request::Session) && + !::ActionDispatch::Request::Session.respond_to?(:each) + # mperham/sidekiq#2460 + # Rack apps can't reuse the Rails session store without + # this monkeypatch + class ActionDispatch::Request::Session + def each(&block) + hash = self.to_hash + hash.each(&block) + end + end +end diff --git a/myapp/config/initializers/session_store.rb b/myapp/config/initializers/session_store.rb index 12441f01..efa55838 100644 --- a/myapp/config/initializers/session_store.rb +++ b/myapp/config/initializers/session_store.rb @@ -6,18 +6,3 @@ Myapp::Application.config.session_store :cookie_store, key: '_myapp_session' # which shouldn't be used to store highly confidential information # (create the session table with "rails generate session_migration") # Myapp::Application.config.session_store :active_record_store - - -# Monkeypatch necessary due to https://github.com/rails/rails/issues/15843 -require 'rack/session/abstract/id' -class Rack::Session::Abstract::SessionHash - private - def stringify_keys(other) - hash = {} - other = other.to_hash unless other.is_a?(Hash) # hack hack hack - other.each do |key, value| - hash[key.to_s] = value - end - hash - end -end