cirandas.net

ref: master

db/migrate/20150112233715_normalize_users_email.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class NormalizeUsersEmail < ActiveRecord::Migration
  def up
    User.find_each do |u|
      u.update_column :email, u.send(:normalize_email)
    end
  end

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