Module: CurrentScope::Scopeable

Extended by:
ActiveSupport::Concern
Defined in:
lib/current_scope/scopeable.rb

Overview

Include CurrentScope::Scopeable to make a model pickable in the scoped-role assignment UI's type dropdown. BROWSE-ONLY — it does NOT gate access: any model is still a valid GlobalID scoped-role target whether or not it opts in.

The included hook self-registers the class by NAME (stored as a string and resolved lazily) so dev-mode class reloading never pins a stale constant; the engine rebuilds the registry on every to_prepare.

Instance Method Summary collapse

Instance Method Details

#current_scope_labelObject

Default label for the picker. Defined as an ordinary instance method so a host that provides its own current_scope_label simply overrides it — the host class sits ahead of this module in the ancestor chain.



19
20
21
# File 'lib/current_scope/scopeable.rb', line 19

def current_scope_label
  "#{model_name.human} ##{id}"
end