Skip to content

Instantly share code, notes, and snippets.

@envygeeks
Last active June 8, 2019 02:57
Show Gist options
  • Save envygeeks/6967127 to your computer and use it in GitHub Desktop.
Save envygeeks/6967127 to your computer and use it in GitHub Desktop.
require 'action_dispatch/middleware/session/redis_store'
module ActionDispatch
module Session
class SignedRedisStore < ActionDispatch::Session::RedisStore
def load_session(env)
stale_session_check! do
get_session(env,
cookie_jar(env)[@key]
)
end
end
def set_cookie(env, session_id, cookie)
cookie_jar(env)[@key] = cookie
end
def cookie_jar(env)
ActionDispatch::Request.new(env).
cookie_jar.signed
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment