Module: Flashtastic

Defined in:
lib/flashtastic.rb,
lib/flashtastic/version.rb,
lib/generators/flashtastic/install/install_generator.rb

Defined Under Namespace

Modules: Generators Classes: Engine

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/flashtastic.rb', line 7

def self.included(base)
  base.after_filter :flash_to_cookie
end

Instance Method Details



11
12
13
14
15
16
17
18
19
# File 'lib/flashtastic.rb', line 11

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