From d57347648f7e2172b262de80b8e5e8e9d6181884 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Mon, 17 Oct 2011 13:29:07 +0300 Subject: [PATCH] Fix migration --- db/migrate/20111011182847_add_extra_fields_to_users.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20111011182847_add_extra_fields_to_users.rb b/db/migrate/20111011182847_add_extra_fields_to_users.rb index 052ba39db..49fbbf1e5 100644 --- a/db/migrate/20111011182847_add_extra_fields_to_users.rb +++ b/db/migrate/20111011182847_add_extra_fields_to_users.rb @@ -3,7 +3,7 @@ class AddExtraFieldsToUsers < ActiveRecord::Migration add_column :users, :nickname, :string add_column :users, :ssh_key, :text add_index :users, :nickname, :unique => true - User.all.each {|u| u.update_attribute :nickname, u.email.split('@').first} + User.all.each {|u| User.where(:id => u.id).update_all(:nickname => u.email.split('@').first)} end def self.down