1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Remove explicit session use, add monkeypatch for Rails bug, #2460

This commit is contained in:
Mike Perham 2015-07-29 09:55:35 -07:00
parent e7f7ea3108
commit 9591d8cbaf
3 changed files with 17 additions and 2 deletions

View file

@ -55,5 +55,6 @@ module Myapp
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.secret_key_base = "sidekiq"
end
end

View file

@ -6,3 +6,18 @@ 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

View file

@ -5,9 +5,8 @@ require 'sidekiq'
# A Web process always runs as client, no need to configure server
Sidekiq.configure_client do |config|
config.redis = { url: 'redis://localhost:6379/0', size: 1 }
config.redis = { url: 'redis://localhost:6379/0', size: 1, namespace: 'foo' }
end
require 'sidekiq/web'
use Rack::Session::Cookie, :secret => "some unique secret string here"
run Sidekiq::Web