From 315322a12598abab0346a5811cf8e8db1fb8fd07 Mon Sep 17 00:00:00 2001 From: Jonas Jabari Date: Fri, 29 Apr 2022 17:55:19 +0200 Subject: [PATCH] fixed layout resolving issue when using turbo-rails gem --- lib/matestack/ui/core/helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matestack/ui/core/helper.rb b/lib/matestack/ui/core/helper.rb index c054fc3b..821c937f 100644 --- a/lib/matestack/ui/core/helper.rb +++ b/lib/matestack/ui/core/helper.rb @@ -36,7 +36,10 @@ def render(*args) if controller_layout == false root_layout = layout ? layout.layout : false else - if controller_layout.nil? + # when using the turbo-rails gem, controller_layout is a Proc + # https://github.com/hotwired/turbo-rails/blob/v1.0.1/app/controllers/turbo/frames/frame_request.rb#L16 + # and not nil or a string indicating which layout to be used like before + if controller_layout.nil? || controller_layout.is_a?(Proc) root_layout = "application" else root_layout = controller_layout