forked from fixin.me/fixin.me
@@ -47,6 +47,8 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def run_and_render(action)
|
||||
send action
|
||||
render action
|
||||
# 2024-01-17, Rails 7.1.2: For unknown reason turbo_stream layout is omitted
|
||||
# during render on POST method only (GET, DESTROY are ok).
|
||||
render action, layout: 'application'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ class UnitsController < ApplicationController
|
||||
def create
|
||||
@unit = current_user.units.new(unit_params)
|
||||
if @unit.save
|
||||
flash[:notice] = t(".success")
|
||||
flash.now[:notice] = t(".success")
|
||||
run_and_render :index
|
||||
else
|
||||
render :new
|
||||
@@ -31,7 +31,7 @@ class UnitsController < ApplicationController
|
||||
|
||||
def update
|
||||
if @unit.update(unit_params)
|
||||
flash[:notice] = t(".success")
|
||||
flash.now[:notice] = t(".success")
|
||||
run_and_render :index
|
||||
else
|
||||
render :edit
|
||||
@@ -40,7 +40,7 @@ class UnitsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
if @unit.destroy
|
||||
flash[:notice] = t(".success")
|
||||
flash.now[:notice] = t(".success")
|
||||
end
|
||||
run_and_render :index
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user