Skip to content

Instantly share code, notes, and snippets.

@vinhnglx
Created August 23, 2014 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinhnglx/a467d2c0f4379857e999 to your computer and use it in GitHub Desktop.
Save vinhnglx/a467d2c0f4379857e999 to your computer and use it in GitHub Desktop.
class AddNameToUser < ActiveRecord::Migration
def self.up
add_column :users, :name, :string
User.reset_column_information
User.find(:all).each do |user|
user.name = user.first_name + ' ' + user.last_name
end
remove_column :users, :first_name
remove_column :users, :last_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment