Module: Padrino::Flash::Helpers

### Home Classes Methods

### In Files

- lib/padrino-core/application/flash.rb

### Methods

- #flash
- #redirect
- #redirect_to

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Application
- Padrino::ApplicationLoadError
- Padrino::ApplicationSetupError
- Padrino::Cli
- Padrino::Cli::Adapter
- Padrino::Cli::Base
- Padrino::Erubis
- Padrino::Erubis::SafeBufferEnhancer
- Padrino::Erubis::SafeBufferTemplate
- Padrino::Erubis::Template
- Padrino::Filter
- Padrino::Flash
- Padrino::Flash::Helpers
- Padrino::Flash::Storage
- Padrino::Logger
- Padrino::Logger::Colorize
- Padrino::Logger::Extensions
- Padrino::Logger::Rack
- Padrino::Module
- Padrino::Mounter
- Padrino::Mounter::MounterException
- Padrino::Reloader
- Padrino::Reloader::Rack
- Padrino::Rendering
- Padrino::Rendering::ClassMethods
- Padrino::Rendering::InstanceMethods
- Padrino::Rendering::SafeTemplate
- Padrino::Rendering::TemplateNotFound
- Padrino::Router
- Padrino::Routing
- Padrino::Routing::ClassMethods
- Padrino::Routing::InstanceMethods
- Padrino::Routing::Parent
- Padrino::Routing::UnrecognizedException
- Padrino::Server
- Padrino::ShowExceptions
- Padrino::Tasks
- Padrino::Utils
- HttpRouter
- HttpRouter::Node
- HttpRouter::Node::Path
- HttpRouter::Request
- HttpRouter::Route
- Haml
- Haml::Helpers
- Haml::Util
- Sinatra
- Sinatra::Request
- Slim
- Slim::Template
- Tilt
- Tilt::HamlTemplate
- FileSet
- Kernel
- Module
- Object
- ObjectSpace
- PadrinoTasks
- String
- SupportLite

No matching classes.

# Padrino::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/padrino-core/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

    # File lib/padrino-core/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
redirect_to(url, *args) click to toggle source
Alias for: redirect

[Validate]

Generated with the Darkfish Rdoc Generator 2.