89d1299ec0
trying out the name "disallow_account_scope" for this, but I don't think it's quite right yet.
25 lines
570 B
Ruby
25 lines
570 B
Ruby
class Sessions::MenusController < ApplicationController
|
|
disallow_account_scope
|
|
|
|
before_action(if: :render_as_menu_section?) { request.variant = :menu_section }
|
|
|
|
layout "public"
|
|
|
|
def show
|
|
@memberships = Current.identity.memberships
|
|
|
|
if params[:without]
|
|
@memberships = @memberships.where.not(tenant: params[:without])
|
|
end
|
|
|
|
if @memberships.one? && !render_as_menu_section?
|
|
redirect_to root_url(script_name: "/#{@memberships.first.tenant}")
|
|
end
|
|
end
|
|
|
|
private
|
|
def render_as_menu_section?
|
|
params[:menu_section]
|
|
end
|
|
end
|