Module: Padrino::Flash::Helpers
- Defined in:
- padrino-core/lib/padrino-core/application/flash.rb
Overview
Storage
Instance Method Summary collapse
-
#flash ⇒ Storage
Returns the flash storage object.
-
#redirect(url, *args) ⇒ Object
(also: #redirect_to)
Overloads the existing redirect helper in-order to provide support for flash messages.
Instance Method Details
#flash ⇒ Storage
Returns the flash storage object.
224 225 226 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 224 def flash @_flash ||= Storage.new(env['rack.session'] ? session[:_flash] : {}) end |
#redirect(url) ⇒ Object #redirect(url, status_code) ⇒ Object #redirect(url, status_code, flash_messages) ⇒ Object #redirect(url, flash_messages) ⇒ Object Also known as: redirect_to
Overloads the existing redirect helper in-order to provide support for flash messages.
205 206 207 208 209 210 211 212 213 214 |
# File 'padrino-core/lib/padrino-core/application/flash.rb', line 205 def redirect(url, *args) flashes = args.last.is_a?(Hash) ? args.pop : {} flashes.each do |type, | = I18n.translate() if .is_a?(Symbol) && defined?(I18n) flash[type] = end super(url, args) end |