Permalink
Browse files

Merge pull request #1789 from grantneufeld/schema_column_exists_optio…

…ns_hash_3_1

Fix default options argument on ActiveRecord::ConnectionAdaptors::Table#column_exists?
  • Loading branch information...
2 parents e7ac539 + 88aa2ef commit 3a92bc790687d06fb8511527400fdb007279b694 @spastorino spastorino committed Jul 6, 2011
@@ -328,7 +328,7 @@ def column(column_name, type, options = {})
end
# Checks to see if a column exists. See SchemaStatements#column_exists?
- def column_exists?(column_name, type = nil, options = nil)
+ def column_exists?(column_name, type = nil, options = {})
@base.column_exists?(@table_name, column_name, type, options)
end
@@ -1071,6 +1071,18 @@ def test_column_exists_with_definition
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?

0 comments on commit 3a92bc7

Please sign in to comment.