Sha256: 96cdbbd2ba8993918e509ecadf30165104d81c494b884869c146aded7a1ffd96
Contents?: true
Size: 460 Bytes
Versions: 18
Compression:
Stored size: 460 Bytes
Contents
class PopulateDeploysUser < ActiveRecord::Migration def up deploys = Deploy.where("deployer IS NOT NULL") pbar = ProgressBar.new("deploys", deploys.count) user_id_by_email = Hash.new { |hash, email| hash[email] = User.find_by_email_address(email).try :id } deploys.find_each do |deploy| user_id = user_id_by_email[deploy.deployer] deploy.update_column :user_id, user_id if user_id pbar.inc end pbar.finish end end
Version data entries
18 entries across 18 versions & 1 rubygems