ref: master
db/migrate/20161213193521_add_manage_environment_kinds_to_admin_role.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
class AddManageEnvironmentKindsToAdminRole < ActiveRecord::Migration def self.up Environment.all.map(&:id).each do |id| role = Environment::Roles.admin(id) role.permissions << 'manage_environment_kinds' role.save! end end def self.down Environment.all.map(&:id).each do |id| role = Environment::Roles.admin(id) role.permissions -= ['manage_environment_kinds'] role.save! end end end |