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
(Don't know how to build task 'migrate --? - Rails - Ruby-Forum) 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:in load’
/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:in load’
/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:in inject’
/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:in inject’
/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:in migrate’
/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:in migrate’
/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:in execute’
/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:in execute’
/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:in synchronize’
/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:in invoke’
/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:in top_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:in top_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:in top_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:in standard_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:in load’
/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 <