Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

create_table cannot be called without block

#2221

Testing against master and 2.3 rc-2

When create_table is called without a block it raises an error:


Person.connection.create_table(:test)

test_create_table_without_a_block(MigrationTest):
LocalJumpError: no block given
    ./test/cases/../../lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in `create_table'
    ./test/cases/migration_test.rb:274:in `test_create_table_without_a_block'
    ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `__send__'
    ./test/cases/../../../activesupport/lib/active_support/testing/setup_and_teardown.rb:62:in `run'

Patch with test and fix attached.

Reported by Joseph Wilk · March 12th, 2009 @ 01:26 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • Tag changed from 2.3-rc2, activerecord, bug, patch to 2.3, 2.3-rc2, activerecord, bug, patch
    • State changed from new to resolved

    Fixed in eb30e4ca40370b416566f1bbaf0204bb379883e4

    June 21st, 2009 @ 08:00 PM

  2. Repository
    Repository

    (from [eb30e4ca40370b416566f1bbaf0204bb379883e4]) Fixed a bug where create_table could not be called without a block [#2221 state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com
    http://github.com/rails/rails/commit/eb30e4ca40370b416566f1bbaf0204...

    June 21st, 2009 @ 09:36 PM

  3. Repository
    Repository

    (from [f2dda7b93c38a7fe5fc04930112e85a311b260e2]) Fixed a bug where create_table could not be called without a block [#2221 state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com
    http://github.com/rails/rails/commit/f2dda7b93c38a7fe5fc04930112e85...

    June 23rd, 2009 @ 10:50 PM

  4. Rob Aldred
    Rob Aldred

    This bug is still present in AR 2.3.2

    ActiveRecord::Base.connection.create_table(:foo)
    LocalJumpError: no block given

    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:104:in `create_table'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/mysql_adapter.rb:473:in `create_table'
    from (irb):9</code>
    
    
    
    

    July 14th, 2009 @ 05:15 PM

  5. Pratik
    Pratik

    It's fixed in 2-3-stable branch. You can use that branch or wait for 2.3.3 to come out.

    July 14th, 2009 @ 05:17 PM

  6. Rob Aldred
    Rob Aldred

    That's great, thanks

    July 14th, 2009 @ 05:24 PM

  7. Craig Buchek
    Craig Buchek
    • Tag changed from 2.3, 2.3-rc2, activerecord, bug, patch to 2.3, 2.3-rc2, 2.3-stable, activerecord, bug, patch

    Hey, this commit never made it into 2.3.3, 2.3.4, 2.3.5, or even 2.3-stable! How the heck did that happen?

    See line 104 in http://github.com/rails/rails/blame/v2.3.5/activerecord/lib/active_... or http://github.com/rails/rails/blob/2-3-stable/activerecord/lib/acti...

    It'd be nice to have this in Rails 2.3.6 (will there be a 2.3.6 release?), but we can just work around it by adding an empty block.

    But it's a bit scary to see that there's a broken process somewhere, where this commit went missing for 3 releases, and still isn't in 2.3-stable. Good to see that it is included in v3.0.0.beta1 and master at least.

    March 30th, 2010 @ 02:47 AM

  8. Repository
    Repository

    (from [ea6ef768a7718f9b4733c7db5b0a49d57440a2d9]) Fixed a bug where create_table could not be called without a block [#2221 state:resolved]

    Signed-off-by: Pratik Naik pratiknaik@gmail.com
    http://github.com/rails/rails/commit/ea6ef768a7718f9b4733c7db5b0a49...

    March 30th, 2010 @ 03:01 AM