require "flashtastic/version" module Flashtastic class Engine < ::Rails::Engine end def self.included(base) base.after_filter :flash_to_cookie end def flash_to_cookie cookies.delete :flashtastic_cookie #starting with clean slate on each request. flash_json = Hash[flash.map{|k,v| [k,ERB::Util.h(v)] }].to_json cookies[:flashtastic_cookie] = { :value => flash_json, :expires => 1.year.from_now } flash.discard end end