-1

I am new to Ruby on Rails and have created an new environment and my first migration. The migration looks like this:

=========================================================================

class CreateUsers < ActiveRecord::Migration
  def up
    create_table :users do |t|
      t.string "first_name", :limit => 25
      t.string "last_name", :limit => 50
      t.string "email", :default =>"", :null =>false
      t.string "password", :limit => 40

      t.timestamps
    end
  end

  def down
    drop_table :users
  end
end

=======================================================================

I save it and I try to run rake with a trace and I get the following error.

=======================================================================

$ rake db:migrate --trace
rake aborted!
NameError: undefined local variable or method `rake' for main:Object
/home/ubuntu/workspace/Rakefile:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-    10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/application.rb:77:in `block in run'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.1.5@rails4/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.1.5@rails4/bin/rake:23:in `<main>'

I have googled and searched Stack-overflow and am none the wiser.

Thank you for your help.

Prakash Murthy
  • 12,923
  • 3
  • 46
  • 74
aboatwri
  • 11
  • 1
  • 3
  • RESOLVED: I created a new environment and compared the Rakefile's and found that I had inadvertantly added a "RAKE" at the top of the file which I deleted. All resolved now. – aboatwri Mar 23 '15 at 17:17
  • You should add this as an answer to your question and mark it as correct so it can be considered resolved. – BarFooBar Mar 23 '15 at 17:36

1 Answers1

1

RESOLVED: I created a new environment and compared the Rakefile's and found that I had inadvertantly added a "RAKE" at the top of the file which I deleted. All resolved now. –

aboatwri
  • 11
  • 1
  • 3