我参考书中的例子在对表结构进行变更新增一个字段的时候,002_add_pice.rb内容:
class AddPice < ActiveRecord::Migration
def self.up
add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0
end
def self.down
remove_column :products, :price
end
end
以上完全是参照书上的,但是在运行rake db:migrate的时候报了错如下:
(in D:/InstantRails-1.2-win/InstantRails/rails_apps/work/depot)
== AddPice: migrating =========================================================
-- add_column(:products, :price, :decimal, {:precision=>8, :scale=>2, :default=>0})
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
请问这个是什么问题?