Sha256: 28cbd74cdce677a9080a114b3f02e3cb2c38ee47c22ba0feba6b6dca13479f5f

Contents?: true

Size: 491 Bytes

Versions: 2

Compression:

Stored size: 491 Bytes

Contents

require File.join(File.dirname(__FILE__), *%w[unobtrusive_flash railtie]) if defined?(::Rails::Railtie)

module UnobtrusiveFlash

  protected

  def prepare_unobtrusive_flash
    if flash.any?
      cookie_flash = []
      if cookies['flash']
        cookie_flash = JSON.parse(cookies['flash']) rescue nil
        cookie_flash=[] unless cookie_flash.is_a? Array
      end

      cookie_flash += flash.to_a

      cookies['flash'] = cookie_flash.to_json
      flash.discard
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unobtrusive_flash-0.0.2 lib/unobtrusive_flash.rb
unobtrusive_flash-0.0.1 lib/unobtrusive_flash.rb