Skip to content
018_set_doc_and_files_notifications.rb 1.15 KiB
Newer Older
class SetDocAndFilesNotifications < ActiveRecord::Migration[4.2]
jplang's avatar
jplang committed
  # model removed
  class Permission < ActiveRecord::Base; end

jplang's avatar
jplang committed
  def self.up
    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
  end

  def self.down
    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
  end
end