Sha256: a906d0e7131bddbd63f345358ed52f80ea3468c104a57fd31ab40ce6a5df6710

Contents?: true

Size: 531 Bytes

Versions: 3

Compression:

Stored size: 531 Bytes

Contents

module CanTango
  class Ability
    module Helper
      module RoleGroup
        include CanTango::Helpers::RoleMethods

        # return list of symbols for role groups the user belongs to
        def role_groups
          return [] if !subject.respond_to?(role_groups_list_meth) || role_groups_of(subject).blank?
          role_groups_of(subject).flatten
        end

        protected

        def role_groups_of subject
          @subj_role_groups ||= subject.send(role_groups_list_meth)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cantango-core-0.1.2 lib/cantango/ability/helper/role_group.rb
cantango-core-0.1.1 lib/cantango/ability/helper/role_group.rb
cantango-core-0.1.0 lib/cantango/ability/helper/role_group.rb