018_set_doc_and_files_notifications.rb 1.15 KB
Newer Older
jplang's avatar
jplang committed
1
class SetDocAndFilesNotifications < ActiveRecord::Migration[4.2]
jplang's avatar
jplang committed
2 3 4
  # model removed
  class Permission < ActiveRecord::Base; end

jplang's avatar
jplang committed
5
  def self.up
6 7 8 9
    Permission.where(:controller => "projects", :action => "add_file").each {|p| p.update_attribute(:mail_option, true)}
    Permission.where(:controller => "projects", :action => "add_document").each {|p| p.update_attribute(:mail_option, true)}
    Permission.where(:controller => "documents", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, true)}
    Permission.where(:controller => "issues", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, true)}
jplang's avatar
jplang committed
10 11 12
  end

  def self.down
13 14 15 16
    Permission.where(:controller => "projects", :action => "add_file").each {|p| p.update_attribute(:mail_option, false)}
    Permission.where(:controller => "projects", :action => "add_document").each {|p| p.update_attribute(:mail_option, false)}
    Permission.where(:controller => "documents", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, false)}
    Permission.where(:controller => "issues", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, false)}
jplang's avatar
jplang committed
17 18
  end
end