Skip to content

Instantly share code, notes, and snippets.

@mislav
Created September 8, 2010 13:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mislav/570149 to your computer and use it in GitHub Desktop.
Save mislav/570149 to your computer and use it in GitHub Desktop.
Sessions fix for Rails 2.3.9 apps
# 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
@josh
Copy link

josh commented Sep 8, 2010

Ha, I totally wrote the same thing!

http://gist.github.com/570160

@josh
Copy link

josh commented Sep 8, 2010

Maybe not, mine eats response cookies.

@mislav
Copy link
Author

mislav commented Sep 8, 2010

OM NOM NOM NOM

@elisehuard
Copy link

thanks !

@cdarne
Copy link

cdarne commented Sep 16, 2010

Thanks a lot :D

@abcreddy
Copy link

Thanks a lot...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment