Module: Roles::Base

Defined in:
lib/roles_active_record/role.rb,
lib/roles_active_record/base.rb

Instance Method Summary collapse

Instance Method Details

#valid_roles_are(*role_list) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/roles_active_record/role.rb', line 2

def valid_roles_are(*role_list)
  strategy_class.valid_roles = role_list.to_symbols
  if role_class_name
    role_list.each do |name|
      begin
        role_class_name.create(:name => name.to_s) # if !role_class_name.where(:name => name.to_s).first
      rescue
        # puts "Role name: #{name} is a duplicate"
      end
    end
  end
end