This project is archived and is in readonly mode.

#6267 ✓stale

Migration: undefined method `to_sym' for nil:NilClass

Reported by EricR | January 8th, 2011 @ 04:06 PM

If a column type is misspelled in a migration (ie; 'boolen'), Rails still allows the migration to take place, which spells disaster. Every migration following that, even a rollback, displays the following error:

undefined method to_sym' for nil:NilClass

The only solution I have found is to manually fix the issue in the sqlite database (big pain) and delete the migration and hope everything returns to normality.

Comments and changes to this ticket

  • dspencer

    dspencer January 8th, 2011 @ 08:31 PM

    Using rails 3.0.3 I didn't experience this problem.


    class CreateTestMigrationErrors < ActiveRecord::Migration
      def self.up
        create_table :test_migration_errors do |t| 
          t.boolean :passes_test
      def self.down
        drop_table :test_migration_errors

    Migration Output

    ==  CreateTestMigrationErrors: migrating ======================================
    -- create_table(:test_migration_errors)
    rake aborted!
    An error has occurred, this and all later migrations canceled:
    undefined method `boolen' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x00000100fbfeb8>
    (See full trace by running task with --trace)

    This behaved like any other failed migration, with no long term defects. Could the problem be other effects of the migration, take took place before the misspelled type in the migration? Rails won't migrate down, because since the migration is unfinished, it might cause errors trying to undo changes which haven't happened, but it doesn't know how to fix just the changes before the typo.

  • rails

    rails April 9th, 2011 @ 01:00 AM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails April 9th, 2011 @ 01:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket