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.

Migration: undefined method `to_sym' for nil:NilClass

#6267

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.

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

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. dspencer
    dspencer

    Using rails 3.0.3 I didn't experience this problem.

    CreateTestMigrationErrors.rb

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

    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.

    January 8th, 2011 @ 08:31 PM

  2. rails
    rails
    • 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.

    April 9th, 2011 @ 01:00 AM

  3. rails
    rails
    • State changed from open to stale

    April 9th, 2011 @ 01:00 AM