On Migration: undefined method `to_sym' for nil:NilClass

后端 未结 9 1887
日久生厌
日久生厌 2020-12-10 12:27

I\'m running Rails 3.0.3 and I accidentally made a typo in my migration: I created a migration that creates a new column with a type of boolen (it should have b

9条回答
  •  [愿得一人]
    2020-12-10 12:32

    As you mentioned in your comments to codeglot once the record is in your database you still get the error when trying to remove the column.

     :books, :name, :inntegr #here I have the order right but spelling is a problem.
    

    To overcome this problem you can manually run sql commands in your migration

      def self.up
        execute "ALTER TABLE books DROP COLUMN name"
      end
    

    hope this helps

提交回复
热议问题