|
@ -1,8 +1,15 @@ |
|
|
# interaction with the flash message |
|
|
# interaction with the flash message |
|
|
class FlashController < ApplicationController |
|
|
class FlashController < ApplicationController |
|
|
def index; end |
|
|
def index; end |
|
|
def redirect_with_notice = redirect_to flash_path, notice: build_message(:notice) |
|
|
|
|
|
def redirect_with_alert = redirect_to flash_path, alert: build_message(:alert) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def redirect_with_notice = redirect_to(flash_path, notice:) |
|
|
|
|
|
def redirect_with_alert = redirect_to(flash_path, alert:) |
|
|
|
|
|
|
|
|
|
|
|
def render_notice |
|
|
|
|
|
flash[:notice] = 'From Render' |
|
|
|
|
|
flash[:alert] = 'Alert Render' |
|
|
|
|
|
render :index |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
def turbo_notice |
|
|
def turbo_notice |
|
|
flash[:notice] = 'From Turbo' |
|
|
flash[:notice] = 'From Turbo' |
|
@ -12,6 +19,9 @@ class FlashController < ApplicationController |
|
|
|
|
|
|
|
|
private |
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def notice = build_message(:notice) |
|
|
|
|
|
def alert = build_message(:alert) |
|
|
|
|
|
|
|
|
def build_message(type_of_message) |
|
|
def build_message(type_of_message) |
|
|
session[:flash_iteration] = session[:flash_iteration].to_i + 1 |
|
|
session[:flash_iteration] = session[:flash_iteration].to_i + 1 |
|
|
"this is #{type_of_message} ##{session[:flash_iteration]}" |
|
|
"this is #{type_of_message} ##{session[:flash_iteration]}" |
|
|