# Migration Issue

**URL:** <https://www.ruby-forum.com/t/migration-issue/80460>\
**Category:** Rails\
**Created:** [December 27, 2006, 4:22am UTC](https://www.ruby-forum.com/t/migration-issue/80460 "2006-12-27T04:22:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 4:22am UTC](https://www.ruby-forum.com/t/migration-issue/80460/1 "2006-12-27T04:22:10Z")

</div>

I’m following along with the example in Agile, and I’m simply trying to  
create a migration to add a price column to a table called products.  
This table exists as my application is displaying it using a scaffold.  
Here’s my migration:

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

However when I run my migration I get the following:

# powerbook-g4-15:~/Documents/work/depot drew$ rake db:migrate (in /Users/drew/Documents/work/depot) == 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)

Any help would be great… I feel like a moron, I’m sure I’ve gotten  
this working before, just trying to follow along with the example in the  
book.

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 5:03am UTC](https://www.ruby-forum.com/t/migration-issue/80460/2 "2006-12-27T05:03:20Z")

</div>

You need to update to Rails 1.2 RC 1. Since the book relies on edge,  
that’s where you can fix your issue.

gem install rails --source [http://gems.rubyonrails.org](http://gems.rubyonrails.org)  
–include-dependencies

is the code to run

For more info:

> **[Rails 1.2: Release Candidate 1](https://rubyonrails.org/2006/11/23/rails-1-2-release-candidate-1)**
>
> It’s been almost eight months since the last major release of Rails introduced RJS, respond\_to, eager loading, and much more. It’s about time we introduced the latest batch of big ideas we’ve been polishing in the interim.Since this is a major new...

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 5:05am UTC](https://www.ruby-forum.com/t/migration-issue/80460/3 "2006-12-27T05:05:20Z")

</div>

Hi, could you post your migration file?

-Conrad

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 5:07am UTC](https://www.ruby-forum.com/t/migration-issue/80460/4 "2006-12-27T05:07:21Z")

</div>

Hi, I see it.

-C

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 5:19am UTC](https://www.ruby-forum.com/t/migration-issue/80460/5 "2006-12-27T05:19:08Z")

</div>

boboroshi wrote:

> You need to update to Rails 1.2 RC 1. Since the book relies on edge,  
> that’s where you can fix your issue.
> 
> gem install rails --source [http://gems.rubyonrails.org](http://gems.rubyonrails.org)  
> –include-dependencies
> 
> is the code to run
> 
> For more info:  
> [Ruby on Rails — Rails 1.2: Release Candidate 1](http://weblog.rubyonrails.org/2006/11/23/rails-1-2-release-candidate-1)

I am running this from inside locomotive, so I attempted to update my  
rails install inside locomotive by doing the following:

gem update rails --source [http://gems.rubyonrails.org](http://gems.rubyonrails.org)  
–include-dependencies

However, now when I do rails -v, I see:

powerbook-g4-15:~/Documents/work/depot drew$ rails -v  
Rails 1.1.6

Still getting the same error as well…

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 5:31am UTC](https://www.ruby-forum.com/t/migration-issue/80460/6 "2006-12-27T05:31:31Z")

</div>

Drew, Agile v2 requires edge/1.2. I don’t think there’s any way around  
it. I would reccomend following Dan Benjamin’s phenomenal step by step  
directions here:

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

and run it that way. It will return as 1.1.6 from shell, but do a gem  
list to verify you’re on edge.

soho:~ jathayde$ rails -v  
Rails 1.1.6

and you’ll see “1.1.6.5618” as the version number.

soho:~ jathayde$ gem list

\*\*\* LOCAL GEMS \*\*\*

actionmailer (1.2.5.5618, 1.2.5)  
Service layer for easy email delivery and testing.

actionpack (1.12.5.5618, 1.12.5)  
Web-flow and rendering framework putting the VC in MVC.

actionwebservice (1.1.6.5618, 1.1.6)  
Web service support for Action Pack.

activerecord (1.14.4.5618, 1.14.4)  
Implements the ActiveRecord pattern for ORM.

activesupport (1.3.1.5618, 1.3.1)  
Support and utility classes used by the Rails framework.

rails (1.1.6.5618, 1.1.6)  
Web-application framework with template engine, control-flow layer,  
and ORM.

EnjoY!

---

<div class="post-metadata">

**Author:** ![dfg59](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e0b2c6/32.png) [@dfg59](https://www.ruby-forum.com/u/dfg59)\
**Post date:** [December 27, 2006, 5:33am UTC](https://www.ruby-forum.com/t/migration-issue/80460/7 "2006-12-27T05:33:58Z")

</div>

boboroshi wrote:

> Drew, Agile v2 requires edge/1.2. I don’t think there’s any way around  
> it. I would reccomend following Dan Benjamin’s phenomenal step by step  
> directions here:

Bob -

Thanks for the help thus far. I do indeed now have Raisl edge/1.2  
installed. However I am receiving the very same error I first discussed.  
Here’s my full trace:

# drew-olsons-powerbook-g4-15:~/Documents/work/depot drew$ rake db:migrate –trace (in /Users/drew/Documents/work/depot) \*\* Invoke db:migrate (first\_time) \*\* Invoke environment (first\_time) \*\* Execute environment \*\* Execute db:migrate == 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.[]  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/connection\_adapters/abstract/schema\_statements.rb:259:in  
`type_to_sql' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:122:in`add\_column’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/migration.rb:273:in  
`method_missing' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in`say\_with\_time’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/1.8/benchmark.rb:293:in  
`measure' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in`say\_with\_time’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/migration.rb:271:in  
`method_missing' ./db/migrate//002_add_price.rb:3:in`real\_up’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/migration.rb:210:in  
`migrate' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/migration.rb:210:in  
`migrate' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:333:in`migrate’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/migration.rb:328:in  
`migrate' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:295:in`up’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/migration.rb:286:in  
`migrate' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/tasks/databases.rake:4 /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in`execute’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in  
`execute' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in`invoke’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/1.8/thread.rb:135:in  
`synchronize' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in`invoke’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in  
`run' /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in`run’  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7  
/Applications/Locomotive2/Bundles/rmagickRailsSept2006\_ppc.locobundle/framework/bin/rake:18  
drew-olsons-powerbook-g4-15:~/Documents/work/depot drew$
