class Strongbolt::Role

Public Instance Methods

inherited_capabilities() click to toggle source

Returns inherited capabilities

# File lib/strongbolt/role.rb, line 29
def inherited_capabilities
  Strongbolt::Capability.joins(:roles)
                        .where('strongbolt_roles.lft < :lft AND strongbolt_roles.rgt > :rgt', lft: lft, rgt: rgt)
                        .distinct
end

Private Instance Methods

should_not_have_children() click to toggle source
# File lib/strongbolt/role.rb, line 37
def should_not_have_children
  if children.count > 0
    raise ActiveRecord::DeleteRestrictionError, :children
  end
end