Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit ea6ef768a7718f9b4733c7db5b0a49d57440a2d9 1 parent bf563bd
Joseph Wilk authored NZKoz committed
2  activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
View
@@ -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)
7 activerecord/test/cases/migration_test.rb
View
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.