module Tennpipes::Flash::Helpers
Public Instance Methods
flash()
click to toggle source
Returns the flash storage object.
@return [Storage]
@since 0.10.8 @api public
# File lib/tennpipes-base/application/flash.rb, line 224 def flash @_flash ||= Storage.new(env['rack.session'] ? session[:_flash] : {}) end
redirect(url, *args)
click to toggle source
Overloads the existing redirect helper in-order to provide support for flash messages.
@overload redirect(url)
@param [String] url
@overload redirect(url, status_code)
@param [String] url @param [Fixnum] status_code
@overload redirect(url, status_code, flash_messages)
@param [String] url @param [Fixnum] status_code @param [Hash] flash_messages
@overload redirect(url, flash_messages)
@param [String] url @param [Hash] flash_messages
@example
redirect(dashboard, success: :user_created) redirect(new_location, 301, notice: 'This page has moved. Please update your bookmarks!!')
@since 0.10.8 @api public
Calls superclass method
# File lib/tennpipes-base/application/flash.rb, line 205 def redirect(url, *args) flashes = args.extract_options! flashes.each do |type, message| message = I18n.translate(message) if message.is_a?(Symbol) && defined?(I18n) flash[type] = message end super(url, args) end
Also aliased as: redirect_to