Quantcast

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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Adam Akhtar-2

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
http://hivelogic.com/narrative/articles/ruby-rails-mongrel-mysql-osx)
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.

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Mohit Sindhwani-2

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.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rake aborted - syntax error, unexpected $end, expecting

Adam Akhtar-2

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

Mohit Sindhwani wrote:

> Chris Bartlett 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.

--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...