当我在下面运行此迁移时,我开始在schema.rb文件中收到错误。我正在关注UUID (tutorial)的教程,我不确定这是否正确。我有它工作正常,但我无法看到schema.rb文件中的表,我无法运行rake db:rollback。
class AddUuidToUsers < ActiveRecord::Migration
def up
add_column :users, :uuid, :uuid
end
def down
remove_column :users, :uuid
end
end
这是我运行rake db:rollback
时的错误undefined method `to_sym' for nil:NilClass/Applications/MAMP/htdocs/Sites/ubergradd/db/migrate/20141024175231_add_uuid_to_users.rb:7:in `down'
NoMethodError: undefined method `to_sym' for nil:NilClass
/Applications/MAMP/htdocs/Sites/ubergradd/db/migrate/20141024175231_add_uuid_to_users.rb:7:in `down'
在我的schema.rb文件中
# Could not dump table "users" because of following NoMethodError
# undefined method `[]' for nil:NilClass