# Trouble with rake

**URL:** <https://www.ruby-forum.com/t/trouble-with-rake/178850>\
**Category:** Rails\
**Created:** [November 12, 2009, 9:13am UTC](https://www.ruby-forum.com/t/trouble-with-rake/178850 "2009-11-12T09:13:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [November 12, 2009, 9:13am UTC](https://www.ruby-forum.com/t/trouble-with-rake/178850/1 "2009-11-12T09:13:57Z")

</div>

Am having trouble with rake file, but can’t find problem. Can you  
help? Haven’t been able to understand the error message returned.

Thank you.

* * *

Macintosh:depot pdenlinger$ rake db:migrate  
(in /Users/pdenlinger/Sites/depot)  
rake aborted!  
./db/migrate//20091112074628\_add\_price\_to\_product.rb:4: syntax error,  
unexpected tASSOC, expecting kEND  
:precision =\> 8, :scale =\> 2, :default =\> 0  
^

(See full trace by running task with --trace)  
Macintosh:depot pdenlinger$ rake db:migrate  
(in /Users/pdenlinger/Sites/depot)  
rake aborted!  
./db/migrate//20091112074628\_add\_price\_to\_product.rb:4: syntax error,  
unexpected tASSOC, expecting kEND  
:precision =\>8, :scale =\>2, :default =\>0  
^

(See full trace by running task with --trace)  
Macintosh:depot pdenlinger$ rake db:migrate  
(in /Users/pdenlinger/Sites/depot)  
rake aborted!  
./db/migrate//20091112074628\_add\_price\_to\_product.rb:4: syntax error,  
unexpected tASSOC, expecting kEND  
:precision =\> 8, :scale =\> 2, :default =\> 0  
^

(See full trace by running task with --trace)  
Macintosh:depot pdenlinger$ rake db:migrate  
(in /Users/pdenlinger/Sites/depot)  
rake aborted!  
./db/migrate//20091112074628\_add\_price\_to\_product.rb:4: syntax error,  
unexpected tASSOC, expecting kEND  
:precision =\> 8, :scale =\> 2, :default =\> 0  
^

(See full trace by running task with --trace)  
Macintosh:depot pdenlinger$ rake db:migrate --trace  
(in /Users/pdenlinger/Sites/depot)  
\*\* Invoke db:migrate (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:migrate  
rake aborted!  
./db/migrate//20091112074628\_add\_price\_to\_product.rb:4: syntax error,  
unexpected tASSOC, expecting kEND  
:precision =\> 8, :scale =\> 2, :default =\> 0  
^  
/Users/pdenlinger/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/  
active\_support/dependencies.rb:145:in  
`load_without_new_constant_marking' /Users/pdenlinger/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/ active_support/dependencies.rb:145:in`load’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/  
active\_support/dependencies.rb:521:in `new_constants_in' /Users/pdenlinger/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/ active_support/dependencies.rb:145:in`load’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/migration.rb:373:in `load_migration' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/migration.rb:369:in`migration’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/migration.rb:365:in `migrate' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/migration.rb:486:in`migrate’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/migration.rb:560:in `call' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/migration.rb:560:in`ddl\_transaction’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/connection\_adapters/abstract/database\_statements.rb:  
136:in `transaction' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/transactions.rb:182:in`transaction’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/migration.rb:560:in `ddl_transaction' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/migration.rb:485:in`migrate’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/migration.rb:472:in `each' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/migration.rb:472:in`migrate’  
/Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/  
active\_record/migration.rb:400:in `up' /Users/pdenlinger/.gem/ruby/1.8/gems/activerecord-2.3.4/lib/ active_record/migration.rb:383:in`migrate’  
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/tasks/databases.rake:116  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in`execute’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in`execute’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in  
`invoke_with_call_chain' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ 1.8/monitor.rb:242:in`synchronize’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in  
`invoke_with_call_chain' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in`invoke’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in  
`invoke_task' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in`top\_level’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in`top\_level’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in  
`standard_exception_handling' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in`top\_level’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in`standard\_exception\_handling’  
/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run' /Library/Ruby/Gems/1.8/gems/rake-0.8.3/bin/rake:31 /usr/bin/rake:19:in`load’  
/usr/bin/rake:19  
Macintosh:depot pdenlinger$ rake db:migrate

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [November 12, 2009, 9:18am UTC](https://www.ruby-forum.com/t/trouble-with-rake/178850/2 "2009-11-12T09:18:03Z")

</div>

Can I see what’s in 20091112074628\_add\_price\_to\_product.rb ?  
It says there’s a syntax error in your migration.

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [November 12, 2009, 11:08am UTC](https://www.ruby-forum.com/t/trouble-with-rake/178850/3 "2009-11-12T11:08:08Z")

</div>

Here you go:

class AddPriceToProduct \< 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

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [November 12, 2009, 12:50pm UTC](https://www.ruby-forum.com/t/trouble-with-rake/178850/4 "2009-11-12T12:50:34Z")

</div>

The missing comma was the problem. The migration worked now.

Thank you.

pauld

---

<div class="post-metadata">

**Author:** ![dangermoose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e79b87/32.png) [@dangermoose](https://www.ruby-forum.com/u/dangermoose)\
**Post date:** [November 12, 2009, 11:40am UTC](https://www.ruby-forum.com/t/trouble-with-rake/178850/5 "2009-11-12T11:40:54Z")

</div>

On Thu, Nov 12, 2009 at 2:06 AM, pauld [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Here you go:
> 
> class AddPriceToProduct \< ActiveRecord::Migration  
> def self.up  
> add\_column :products, :price, :decimal  
> :precision =\> 8, :scale =\> 2, :default =\> 0

It seems that you have missed a comma after the field type (i.e.  
decimal)  
and it should be  
implemented as follows:

add\_column :products, :price, :decimal, :precision =\> 8, :scale =\> 2,  
:default =\> 0

Thus, the migration should look as follows:

class AddPriceToProduct \< 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

Good luck,

-Conrad

> end

def self.down
