One way you can do this is in the controller. You can create a new layout called custom_layout.erb
in app/views/layouts
and then in your controller, you can reference the layout in the action
def show
render layout: "custom_layout"
end
Or for the whole controller
class HomeController < ApplicationController
layout "custom_layout"
def show
end
end
Check out the Rails Guide - Layouts and Rendering Sections 2.2.11.2 and 2.2.12 for more examples
Hope this helps