Sha256: 1d5bd6c4814eb9956f1311c63e971eed9ef1282b90dcad6699b683cad23e762c

Contents?: true

Size: 1013 Bytes

Versions: 13

Compression:

Stored size: 1013 Bytes

Contents

module Innate
  module Helper
    # Simple access to session.flash.
    #
    # Flash is a mechanism using sessions to provide a rotating holder of
    # key/value pairs.
    #
    # Every request that is made will rotate one step, dropping contents stored
    # two requests ago.
    #
    # The purpose of this class is to provide an easy way of setting/retrieving
    # from the current flash.
    #
    # Flash is a way to keep a temporary pairs of keys and values for the duration
    # of two requests, the current and following.
    #
    # Very vague Example:
    #
    # On the first request, for example on registering:
    #
    #   flash[:error] = "You should reconsider your username, it's taken already"
    #   redirect r(:register)
    #
    # This is the request from the redirect:
    #
    #   do_stuff if flash[:error]
    #
    # On the request after this, flash[:error] is gone.
    module Flash
      # Just for convenience
      def flash
        session.flash
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
innate-2023.01.06 lib/innate/helper/flash.rb
innate-2015.10.28 lib/innate/helper/flash.rb
innate-2013.02.21 lib/innate/helper/flash.rb
innate-2013.02 lib/innate/helper/flash.rb
innate-2012.12 lib/innate/helper/flash.rb
innate-2012.03 lib/innate/helper/flash.rb
innate-2011.12 lib/innate/helper/flash.rb
innate-2011.10 lib/innate/helper/flash.rb
innate-2011.04 lib/innate/helper/flash.rb
innate-2011.01 lib/innate/helper/flash.rb
innate-2010.07 lib/innate/helper/flash.rb
innate-2010.06.18 lib/innate/helper/flash.rb
innate-2010.04 lib/innate/helper/flash.rb