# Rake db:migration error from Book

**URL:** <https://www.ruby-forum.com/t/rake-db-migration-error-from-book/112209>\
**Category:** Rails\
**Created:** [August 16, 2007, 12:35pm UTC](https://www.ruby-forum.com/t/rake-db-migration-error-from-book/112209 "2007-08-16T12:35:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubysharma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a5b964/32.png) [@rubysharma](https://www.ruby-forum.com/u/rubysharma)\
**Post date:** [August 16, 2007, 12:35pm UTC](https://www.ruby-forum.com/t/rake-db-migration-error-from-book/112209/1 "2007-08-16T12:35:19Z")

</div>

Hi,

Right now I am working on the application given from the book

Pragmatic.Bookshelf.Agile.Web.Development.with.Rails.2nd.Edition.Dec.2006

On page 80. I have done the rake db:migrate on the code…

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

When we do rake db:migrate it results in error…

Microsoft Windows XP [Version 5.1.2600]  
© Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Sharma\>cd  
c:\radrails\_projects\depotaugust152007

# C:\radrails\_projects\depotaugust152007\>rake db:migrate (in C:/radrails\_projects/depotaugust152007) == AddPrice: migrating

– add\_column(:products, :price, :decimal, {:default=\>0, :precision=\>8,  
: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)

C:\radrails\_projects\depotaugust152007\>

Please suggest me the ways to solve this…

Thanks in advance sharma
