Sha256: 06284537682a9cd158ca24a848a8f84ddff3376d1380a221bc9ff7c7ebc83e99
Contents?: true
Size: 620 Bytes
Versions: 5
Compression:
Stored size: 620 Bytes
Contents
module CacheableFlash module Controller def self.included(base) base.prepend_around_action :write_flash_to_cookie end def write_flash_to_cookie yield self cookie_flash = begin JSON.parse(cookies["flash"] || "{}") rescue JSON::ParserError {} end flash.each do |key, value| if cookie_flash[key.to_s].blank? cookie_flash[key.to_s] = value else cookie_flash[key.to_s] << "<br/>#{value}" # TODO should be an array end end cookies['flash'] = cookie_flash.to_json flash.clear end end end
Version data entries
5 entries across 5 versions & 1 rubygems