You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
586 B
19 lines
586 B
# interaction with the flash message
|
|
class FlashController < ApplicationController
|
|
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 turbo_notice
|
|
flash[:notice] = 'From Turbo'
|
|
flash[:alert] = 'Alert Turbo'
|
|
render turbo_stream: flash_stream
|
|
end
|
|
|
|
private
|
|
|
|
def build_message(type_of_message)
|
|
session[:flash_iteration] = session[:flash_iteration].to_i + 1
|
|
"this is #{type_of_message} ##{session[:flash_iteration]}"
|
|
end
|
|
end
|