Created
August 27, 2013 07:43
-
-
Save tony612/6350745 to your computer and use it in GitHub Desktop.
use Model.reset_column_information to let the modification work, and use say_with_time to explain the action..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddAddressToEvent < ActiveRecord::Migration | |
def up | |
add_column :events, :address, :string, :after => :lat | |
Event.reset_column_information | |
say_with_time "Update each event, which will result in all events to update their address" do | |
Event.find_each { |event| event.save! } | |
end | |
end | |
def down | |
remove_column :events, :address | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment