Sha256: 498d7a0acb61ee33e0b02cfabccaf0c7f2ffde4be4c1e4a2af478cef54088c56
Contents?: true
Size: 503 Bytes
Versions: 2
Compression:
Stored size: 503 Bytes
Contents
require 'active_support/concern' module Glow module Filter extend ActiveSupport::Concern included do after_filter :flash_to_headers end def flash_to_headers return unless flash.any? && request.xhr? type, message = flash.first response.headers['X-Message'] = message.to_s.unpack('U*').map{ |i| "&##{i};" }.join response.headers['X-Message-Type'] = type.to_s flash.discard # don't want the flash to appear when you reload page end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
glow-0.0.11 | lib/glow/filter.rb |
glow-0.0.10 | lib/glow/filter.rb |