Sha256: 8d616070fb40f210a606c3527e0a47a72f6c3d3fb30c94aa39735d6a725b0d16

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flashtastic-0.0.1 lib/flashtastic.rb