cirandas.net

ref: master

db/migrate/20150103134141_add_edit_raw_html_block_to_admin_role.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class AddEditRawHtmlBlockToAdminRole < ActiveRecord::Migration
  def self.up
    Environment.all.map(&:id).each do |id|
      role = Environment::Roles.admin(id)
      role.permissions << 'edit_raw_html_block'
      role.save!
    end
  end

  def self.down
    Environment.all.map(&:id).each do |id|
      role = Environment::Roles.admin(id)
      role.permissions -= ['edit_raw_html_block']
      role.save!
    end
  end
end