Sha256: 2028cd7767dc0487c31d9469d53f6d2a475295c938a5a26fa4221b0800d0e32e
Contents?: true
Size: 633 Bytes
Versions: 2
Compression:
Stored size: 633 Bytes
Contents
module CacheableFlash class Middleware require 'cacheable_flash/cookie_flash' include CookieFlash FLASH_HASH_KEY = "action_dispatch.request.flash_hash".freeze def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) flash = env[FLASH_HASH_KEY] if flash response = Rack::Response.new(body, status, headers) cookies = env["rack.cookies"] || {} response.set_cookie("flash", { :value => cookie_flash(flash, cookies), :path => "/" }) response.finish else [status, headers, body] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cacheable_flash-0.2.9 | lib/cacheable_flash/middleware.rb |
cacheable_flash-0.2.8 | lib/cacheable_flash/middleware.rb |