cirandas.net

ref: master

db/migrate/20140318233831_finish_enterprise_activation_for_enabled_enterprises.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class FinishEnterpriseActivationForEnabledEnterprises < ActiveRecord::Migration
  def self.up
    EnterpriseActivation.find_each do |enterprise_activation|
      enterprise = enterprise_activation.enterprise
      next unless enterprise.present? && enterprise.enabled
      enterprise_activation.update_attribute :status, Task::Status::FINISHED
    end
  end

  def self.down
    say "this migration can't be reverted"
  end
end