Permalink
Browse files

Fixed a bug where create_table could not be called without a block [#…

…2221 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent b26c2c1 commit eb30e4ca40370b416566f1bbaf0204bb379883e4 Joseph Wilk committed with lifo Mar 12, 2009
@@ -101,7 +101,7 @@ def create_table(table_name, options = {})
table_definition = TableDefinition.new(self)
table_definition.primary_key(options[:primary_key] || Base.get_primary_key(table_name)) unless options[:id] == false
- yield table_definition
+ yield table_definition if block_given?
if options[:force] && table_exists?(table_name)
drop_table(table_name, options)
@@ -293,6 +293,13 @@ def test_create_table_with_timestamps_should_create_datetime_columns_with_option
Person.connection.drop_table table_name rescue nil
end
+ def test_create_table_without_a_block
+ table_name = :testings
+ Person.connection.create_table table_name
+ ensure
+ Person.connection.drop_table table_name rescue nil
+ end
+
# Sybase, and SQLite3 will not allow you to add a NOT NULL
# column to a table without a default value.
unless current_adapter?(:SybaseAdapter, :SQLiteAdapter)

0 comments on commit eb30e4c

Please sign in to comment.