Skip to content

Instantly share code, notes, and snippets.

@jdelStrother
Created June 10, 2012 20:31
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 jdelStrother/2907225 to your computer and use it in GitHub Desktop.
Save jdelStrother/2907225 to your computer and use it in GitHub Desktop.
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index a448e0a..6d3b0a8 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -1708,6 +1708,18 @@ if ActiveRecord::Base.connection.supports_migrations?
end
end
+ def test_add_column_persists_values
+ Person.create!
+
+ Person.connection.add_column :people, :favorite_food, :string
+ Person.find_each do |p|
+ p.favorite_food = "hotdogs"
+ p.save!
+ end
+
+ assert_equal "hotdogs", Person.last.favorite_food
+ end
+
protected
def with_env_tz(new_tz = 'US/Eastern')
old_tz, ENV['TZ'] = ENV['TZ'], new_tz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment