Created
June 14, 2010 02:41
-
-
Save avit/437218 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://rails.lighthouseapp.com/projects/8994/tickets/4743-session-cookie-breaks-if-used-with-custom-cookie-in-rails-238 | |
# http://gist.github.com/431811 | |
if Rails.version == '2.3.8' | |
class RackRailsCookieHeaderHack | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
status, headers, body = @app.call(env) | |
if headers['Set-Cookie'] && headers['Set-Cookie'].respond_to?(:collect!) | |
headers['Set-Cookie'].collect! { |h| h.strip } | |
end | |
[status, headers, body] | |
end | |
end | |
Rails.configuration.after_initialize do | |
ActionController::Dispatcher.middleware.insert_before( | |
ActionController::Base.session_store, RackRailsCookieHeaderHack | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment