Skip to content

Instantly share code, notes, and snippets.

@ckozus
Created December 7, 2012 18:32
Show Gist options
  • Save ckozus/4235322 to your computer and use it in GitHub Desktop.
Save ckozus/4235322 to your computer and use it in GitHub Desktop.
migracion con modificacion de datos en el medio
add_column :users, :title, :string
User.reset_column_information
User.all.each do |user|
user.title = Title.find_by_id(user.title_id).name
user.save!
end
drop_table :titles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment