cirandas.net

ref: master

db/migrate/20150210143723_add_custom_roles_permission_to_admin_roles.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class AddCustomRolesPermissionToAdminRoles < ActiveRecord::Migration
  def self.up
    environment_admin = Role.find_by(key: "environment_administrator")
    profile_admin = Role.find_by(key: "profile_admin")
    environment_admin.permissions.append("manage_custom_roles")
    profile_admin.permissions.append("manage_custom_roles")
    environment_admin.save!
    profile_admin.save!
  end
  def self.down
    environment_admin = Role.find_by(key: "environment_administrator")
    profile_admin = Role.find_by(key: "profile_admin")
    environment_admin.permissions.delete("manage_custom_roles")
    profile_admin.permissions.delete("manage_custom_roles")
    environment_admin.save!
    profile_admin.save!
  end
end