Chris Bartlett
2007-Apr-17 03:14 UTC
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 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mohit Sindhwani
2007-Apr-17 03:19 UTC
Re: 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. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Bartlett
2007-Apr-17 20:11 UTC
Re: Rake aborted - syntax error, unexpected $end, expecting
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---