refactor
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
# 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 turbo_notice
|
def turbo_notice
|
||||||
flash[:notice] = 'From Turbo'
|
flash[:notice] = 'From Turbo'
|
||||||
@@ -8,14 +10,6 @@ class FlashController < ApplicationController
|
|||||||
render turbo_stream: flash_stream
|
render turbo_stream: flash_stream
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_with_notice
|
|
||||||
redirect_to flash_path, notice: build_message(:notice)
|
|
||||||
end
|
|
||||||
|
|
||||||
def redirect_with_alert
|
|
||||||
redirect_to flash_path, alert: build_message(:alert)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def build_message(type_of_message)
|
def build_message(type_of_message)
|
||||||
|
|||||||
Reference in New Issue
Block a user