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

Chris Bartlett wrote:

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

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.