Skip to content

Instantly share code, notes, and snippets.

@abcreddy
Forked from mislav/sessions_patch.rb
Created July 24, 2013 12:46
Show Gist options
  • Save abcreddy/6070245 to your computer and use it in GitHub Desktop.
Save abcreddy/6070245 to your computer and use it in GitHub Desktop.
# patch for Rails 2.3.9 (ticket #5581)
# (drop in your config/initializers/ dir)
affected = %w[ActiveRecord::SessionStore ActionController::Session::MemCacheStore]
target = Rails.configuration.middleware.detect do |mid|
mid.klass.is_a? Class and affected.include? mid.klass.to_s
end
if target
class RailsCookieMonster
def initialize(app)
@app = app
end
def call(env)
# monster MUST HAVE COOKIES om nom nom nom
env['HTTP_COOKIE'] ||= ""
@app.call(env)
end
end
Rails.configuration.middleware.insert_before target, RailsCookieMonster
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment