Skip to content

Commit

Permalink
Remove explicit session use, add monkeypatch for Rails bug, sidekiq#2460
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Jul 29, 2015
1 parent e7f7ea3 commit 9591d8c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions myapp/config/application.rb
Expand Up @@ -55,5 +55,6 @@ class Application < Rails::Application

# 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
15 changes: 15 additions & 0 deletions myapp/config/initializers/session_store.rb
Expand Up @@ -6,3 +6,18 @@
# 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
3 changes: 1 addition & 2 deletions myapp/simple.ru
Expand Up @@ -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

0 comments on commit 9591d8c

Please sign in to comment.