Class: FlashSessionCookieMiddleware
- Inherits:
-
Object
- Object
- FlashSessionCookieMiddleware
- Defined in:
- lib/flash_session_cookie_middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, session_key = ActionController::Base.session_options[:key]) ⇒ FlashSessionCookieMiddleware
constructor
A new instance of FlashSessionCookieMiddleware.
Constructor Details
#initialize(app, session_key = ActionController::Base.session_options[:key]) ⇒ FlashSessionCookieMiddleware
Returns a new instance of FlashSessionCookieMiddleware.
4 5 6 7 |
# File 'lib/flash_session_cookie_middleware.rb', line 4 def initialize(app, session_key = ActionController::Base.[:key]) @app = app @session_key = session_key end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/flash_session_cookie_middleware.rb', line 9 def call(env) if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ req = Rack::Request.new(env) unless req.params[@session_key].nil? env['HTTP_COOKIE'] = "#{@session_key}=#{req.params[@session_key].gsub(' ','%2B')}".freeze end end @app.call(env) end |