cirandas.net

ref: master

db/migrate/065_add_view_private_content_permission.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class AddViewPrivateContentPermission < ActiveRecord::Migration
  def self.up
    admin = Profile::Roles.admin
    admin.permissions += ['view_private_content']
    admin.save

    moderator = Profile::Roles.moderator
    moderator.permissions += ['view_private_content']
    moderator.save
  end

  def self.down
    admin = Profile::Roles.admin
    admin.permissions -= ['view_private_content']
    admin.save

    moderator = Profile::Roles.moderator
    moderator.permissions -= ['view_private_content']
    moderator.save
  end
end