From 3e4f535a469b5a02ca02c4433ca1d04d736c87ff Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 10 Jul 2024 01:21:16 +0400 Subject: [PATCH] flash stream --- app/controllers/application_controller.rb | 3 +++ app/controllers/flash_controller.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 09705d1..a1e11f8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,2 +1,5 @@ class ApplicationController < ActionController::Base + private + + def flash_stream = turbo_stream.replace(:notification, partial: 'layouts/notification') end diff --git a/app/controllers/flash_controller.rb b/app/controllers/flash_controller.rb index 4b22223..1624eaa 100644 --- a/app/controllers/flash_controller.rb +++ b/app/controllers/flash_controller.rb @@ -5,7 +5,7 @@ class FlashController < ApplicationController def turbo_notice flash[:notice] = 'From Turbo' flash[:alert] = 'Alert Turbo' - render turbo_stream: turbo_stream.replace(:notification, partial: 'layouts/notification') + render turbo_stream: flash_stream end def redirect_with_notice