参考web敏捷开发的书有个问题!
MH2o 2008-09-10 11:01:58 书中讲到添加字段的时候我按照书中的内容编写了添加的脚本 002
class AddPrice < 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
但是在执行的时候报一下的错误:
== AddPrice: migrating ========================================================
-- add_column(:products, :price, :decimal, {:precision=>8, :default=>0, :scale=>2})
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.[]
(See full trace by running task with --trace)
我看了一下,ruby和rails的版本都是和书中的一样的。请问这个是什么原因?