I could not find any docs or examples on how to structure my app to allow different views in the same controller to use completely different layouts and stylesheets.
I am sure there's plenty of answers to this but here's another one where you can use different layouts per controllers or per action.
class ListingsController < ApplicationController
# every action will use the layout template app/views/layouts/listing_single.html.erb
layout 'listing_single'
# the 'list' action will use the layout set in the 'alternative_layout' method
# you can also add multiple actions to use a different layout,just do like layout :alternative_layout, only: [:list,:another_action]
layout :alternative_layout, :only => :list
def show
end
def list
end
private
def alternative_layout
if current_user.is_super_admin?
#if current use is super admin then use the layout found in app/views/layouts/admin.html.erb otherwise use the layout template in app/views/layouts/listing_list.html.erb
'admin'
else
'listing_list'
end
end
end