Sha256: b730869da3aa03e2ad7d28ee30cb9a5c3740ea06007d8ce2176b4f507c176aa9
Contents?: true
Size: 548 Bytes
Versions: 8
Compression:
Stored size: 548 Bytes
Contents
require 'active_support/concern' module Glow module Filter extend ActiveSupport::Concern included do after_filter :flash_to_headers end module InstanceMethods 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 end
Version data entries
8 entries across 8 versions & 1 rubygems