Don't know how to build task 'migrate'

Hi,

I have a rather simple problem. Just installed Rails on OS X Leopard and
the database connection to MySQL doesn’t work from Rails.
I’m following Apples Expenses example
(http://developer.apple.com/tools/rubyonrails.html).
I’ve created the app with the command

rails expenses -d mysql

I can connect to the database with a GUI tool, but Rails can’t
communicate with it.

When I run

rake migrate

i get the error “Don’t know how to build task ‘migrate’”.

The I found a thread here on Ruby Forum
(http://www.ruby-forum.com/topic/141986) which describes almost the same
problem and tried the command

rake db:migrate --trace

which gives me this error:


rake db:migrate --trace
(in /Users/morten/Projects/expenses)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
./db/migrate//001_accounts.rb:11: syntax error, unexpected $end,
expecting kEND
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:inload’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:inload’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:360:in
migration_classes' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:286:ininject’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in
each' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:ininject’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in
migration_classes' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:339:inmigrate’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:307:in
up' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:298:inmigrate’
/usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:85
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in call' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in
invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:insynchronize’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in
invoke_with_call_chain' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in
invoke_task' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:intop_level’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:intop_level’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in
standard_exception_handling' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:intop_level’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:instandard_exception_handling’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 /usr/local/bin/rake:19:inload’
/usr/local/bin/rake:19

Can you help me in the right direction?

On 17 Mar 2008, at 10:13, Morten Nielsen wrote:

When I run

rake migrate

i get the error “Don’t know how to build task ‘migrate’”.

migrate was renamed db:migrate

rake aborted!
./db/migrate//001_accounts.rb:11: syntax error, unexpected $end,
expecting kEND

Looks like you’ve a syntax error in that migration.

Fred

Frederick C. wrote:

On 17 Mar 2008, at 10:13, Morten Nielsen wrote:

When I run

rake migrate

i get the error “Don’t know how to build task ‘migrate’”.

migrate was renamed db:migrate

rake aborted!
./db/migrate//001_accounts.rb:11: syntax error, unexpected $end,
expecting kEND

Looks like you’ve a syntax error in that migration.

Fred

You’re right - I was missing a “end” after the create_table. Thank you.
Now I’ve learned to read the trace log or whatever the right name for it
is.

Morten

Hi Mortein,

I think u have syntax error on "End" keyword in   001_accounts.rb 

file.

On Mon, Mar 17, 2008 at 3:43 PM, Morten Nielsen <

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs