Module: Rhino::RouteGroupContext
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rhino/concerns/route_group_context.rb
Overview
Places a custom (non-Rhino) controller into a Rhino route group, so the resource-scope resolver knows whether the request has a tenant boundary.
Rhino's own generated controllers already publish their group; a controller you write yourself is outside that chain, so include this concern in it:
class Admin::DashboardController < ApplicationController
include Rhino::RouteGroupContext
rhino_route_group :admin
def summary
# :admin is declared `tenant: false`, so this spans every organization
# instead of raising Rhino::MissingTenantContext.
render json: { tasks: Rhino.query(Task).count }
end
end
Without an explicit rhino_route_group, the group is read from the route's
own route_group default:
get "/api/admin/dashboard", to: "admin/dashboard#summary",
defaults: { route_group: "admin" }