Skip to content

Commit

Permalink
Fixed a bug where create_table could not be called without a block [#…
Browse files Browse the repository at this point in the history
…2221 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
Joseph Wilk authored and NZKoz committed Mar 30, 2010
1 parent bf563bd commit ea6ef76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -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.to_s.singularize)) 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)
Expand Down
7 changes: 7 additions & 0 deletions activerecord/test/cases/migration_test.rb
Expand Up @@ -311,6 +311,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)
Expand Down

0 comments on commit ea6ef76

Please sign in to comment.