Rake aborted - syntax error, unexpected $end, expecting kEND

I can’t create tables via rake db:migrate without encountering this
error:

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

The 001_create_users_table.rb file contains:

class CreateUsersTable < ActiveRecord::Migration
def self.up
create_table “users” do |table|
end

def self.down
end
end

I’ve recently installed RoR (as per
Dan Benjamin)
and have been able to verify that everything is installed. I can create
tables ‘manually’ in MySQL databases, but rake is failing every time
with the same error as above.

Any help would be greatly appreciated. I’m investigating RoR with a view
to building some web apps with it, but this is hardly an auspicious
beginning.

Chris B. wrote:

class CreateUsersTable < ActiveRecord::Migration
def self.up
create_table “users” do |table|

end

You have a do in the line above which should be terminated with an end.
This “end” closes the “do” above, but nothing closes the “def” for the
self.up method.

def self.down
end
end

Try something like:

class CreateUsersTable < ActiveRecord::Migration
def self.up
create_table “users” do |table|
#do something here like creating fields inside the table
end
end

def self.down
end
end

Cheers
Mohit.

Thanks for your reply - you’re quite right, of course. I’ll pay more
attention when copying and pasting sample code next time!

Mohit S. wrote:

Chris B. wrote:

class CreateUsersTable < ActiveRecord::Migration
def self.up
create_table “users” do |table|

end

You have a do in the line above which should be terminated with an end.
This “end” closes the “do” above, but nothing closes the “def” for the
self.up method.