class Ditty::RolesController

Constants

SEARCHABLE

Public Instance Methods

parent_options(entity) click to toggle source
# File lib/ditty/controllers/roles_controller.rb, line 14
def parent_options(entity)
  return policy_scope(::Ditty::Role) if entity.new?

  policy_scope(::Ditty::Role)
    .exclude(id: [entity.id] + entity.descendants.map(&:id))
    .order(:name)
end