From 3cc83a8f24ba61b648a2728efc113388cf1ec243 Mon Sep 17 00:00:00 2001 From: Grant Neufeld Date: Sat, 18 Jun 2011 14:38:38 -0600 Subject: Changed the default value for the options argument on ActiveRecord::ConnectionAdapters::Table#column_exists? from nil to an empty Hash {}. That method calls through to ActiveRecord::ConnectionAdapters::SchemaStatements##column_exists? expects options to be a Hash. When options was nil, an error would occur in cases where the column did exist because the called method attempted to perform a key lookup on options. --- activerecord/test/cases/migration_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/test/cases/migration_test.rb') diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index bf7565a0d0..93a1249e43 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1071,6 +1071,18 @@ if ActiveRecord::Base.connection.supports_migrations? Person.connection.drop_table :testings rescue nil end + def test_column_exists_on_table_with_no_options_parameter_supplied + Person.connection.create_table :testings do |t| + t.string :foo + end + Person.connection.change_table :testings do |t| + assert t.column_exists?(:foo) + assert !(t.column_exists?(:bar)) + end + ensure + Person.connection.drop_table :testings rescue nil + end + def test_add_table assert !Reminder.table_exists? -- cgit v1.2.3