about summary refs log tree commit diff
path: root/db/seeds/03_roles.rb
blob: 7fedf0f7118b7ebd2169858e15cddfcbbb6f3d2d (plain) (blame)
1
2
3
4
5
6
7
8
9
# Pre-create base role
UserRole.everyone

# Create default roles defined in config file
default_roles = YAML.load_file(Rails.root.join('config', 'roles.yml'))

default_roles.each do |_, config|
  UserRole.create_with(position: config['position'], permissions_as_keys: config['permissions'], highlighted: true).find_or_create_by(name: config['name'])
end