rake aborted! undefined method `prerequisites' for nil:NilClass - ruby-on-rails

Spoiler: It was an outdated version of the rspec-rails gem!
I encountered this error with any rake command issued from my rails project directory after moving my sqlite3 gem into a development block and then running 'rake db:migrate' to make sure everything still worked. Rake works fine elsewhere on my system. But any rake task I run in that directory gives me the following output with the trace:
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec/rails/tasks/rspec.rake:3:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `block in <class:Railtie>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `call'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application.rb:103:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/ianyoung/rails/third_app/Rakefile:7:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
The first error I got was the question title:
rake aborted! undefined method `prerequisites' for nil:NilClass
I've also been getting this, but it hasn't been causing me problems. Perhaps it's relevant?:
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from at /Users/ianyoung/rails/third_app/config/application.rb:13)
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from at /Users/ianyoung/rails/third_app/config/application.rb:13)

Updating to the latest rspec-rails gem relieved me of this problem and of the deprecation warnings.
Installing the latest webrat gem solved the missing has_selector? method problem that I had for some reason thought was a greater evil than my outdated rspec-rails gem. And all is well.
Thank you for the helpful comments.

Related

rake task does not launch for lack of Mime JSON

After installing a repository locally and bundling for a rails 4.0 application, the database creation
rake db:create
command fails returning the following error:
uninitialized constant Mime::JSON
invoking from application.rb this particular line
Bundler.require(:default, Rails.env)
this line is preceeded by:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
How can I get rake to properly process?
** update **
as per request full stack trace follows. I did manage to avoid the error by removing the jbuilder gem.
NameError: uninitialized constant Mime::JSON
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/jbuilder-1.5.3/lib/jbuilder/jbuilder_template.rb:110:in `<class:JbuilderHandler>'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/jbuilder-1.5.3/lib/jbuilder/jbuilder_template.rb:108:in `<top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/jbuilder-1.5.3/lib/jbuilder.rb:358:in `<top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `require'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `each'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `block in require'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
/Volumes/Mo/r/uelcom/config/application.rb:7:in `<top (required)>'
/Volumes/Mo/r/uelcom/Rakefile:8:in `require'
/Volumes/Mo/r/uelcom/Rakefile:8:in `<top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_module.rb:29:in `load'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_module.rb:29:in `load_rakefile'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:703:in `raw_load_rakefile'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:104:in `block in load_rakefile'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:103:in `load_rakefile'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:82:in `block in run'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/application.rb:80:in `run'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/bin/rake:23:in `load'
/Users/deploy/.rbenv/versions/2.6.1/bin/rake:23:in `<top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/Users/deploy/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/Users/deploy/.rbenv/versions/2.6.1/bin/bundle:23:in `load'
/Users/deploy/.rbenv/versions/2.6.1/bin/bundle:23:in `<main>'
It seems you are using rails 5 or above.
As of rails version 5 or above accessing Mime types through Mime::JSON is deprecated, We need to access it as Mime[:json]
Please find the following references for the same - Release Note and Pull request
Deprecated accessing mime types via constants (eg. Mime::HTML). Use the subscript operator with a symbol instead (eg. Mime[:html])
As per the backtrace of the exception you have given, the gem jbuilder is causing the issue, which accesses Mime types as Mime::JSON which is deprecated.
Please find the reference of the line which causes the error on the gem jbuilder - Jubilder - Github.
You are using the older version of the jbuilder(1.5.3), please upgrade this gem to the latest version and try
Try the below version:
Gemfile
gem 'jbuilder', '~> 2.10'

upgrading to ruby 2.3.0 NameError: uninitialized constant I18n::Config::Backend

I just upgraded Ruby 2.2.2 to 2.3.0. Whenever I run a rake task I get the following error:
Christians-Air:my_rails_app cman77$ rake --trace
rake aborted!
NameError: uninitialized constant I18n::Config::Backend
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `block in run_tasks_blocks'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `each'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `run_tasks_blocks'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/application.rb:452:in `run_tasks_blocks'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:453:in `load_tasks'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing'
/Users/cman77/Dropbox/rails_projects/my_rails_app/Rakefile:9:in `<top (required)>'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/bin/rake:23:in `load'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/bin/rake:23:in `<main>'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/cman77/.rvm/gems/ruby-2.3.0#jbio.3.0/bin/ruby_executable_hooks:15:in `<main>'
Anyone have experience with this? I am really stuck in terms of how to even begin to diagnose/remedy this issue.
Here is the contents of my Rakefile:
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
ENV['NEWRELIC_ENABLE'] = 'false'
MyRailsApp::Application.load_tasks
This appears to be the offending line referenced in the I18n gem:
https://github.com/svenfuchs/i18n/blob/master/lib/i18n/config.rb#L18
Update: it seems to be tied to the use of include ActionView::Helpers::TranslationHelper in one of my rake files. If I remove that line I can run rake commands.
Update2: Removing include ActionView::Helpers::TranslationHelper and replacing (t "some_text") with (I18n.t "some_text") completely resolved the issue. I will still award the bounty to anyone who can explain why this broke with a Ruby upgrade!
My guess is that you experienced that problem because you ere using the t method (an helper for controllers and views) in a rake task, instead of the standard I18n.t.
This is an uncommon and unconventional approach, so you have fallen in a possible regression that few have experienced and it has a simple solution, like the one you found: stick to the conventions.

Cannot load mysql2 gem

I've already seen some different answers, but none of these helped me...
This is the trick: I have to fix this without touching the Gemfile. I'm currently creating my working environment so that it matches the production server, so, I cannot modify the rails' code at all.
My OS: OSX 10.11
Ruby: ruby 2.0.0p643
Rails: 4.0.0
The gem is the Gemfile as gem 'mysql2'. There are no errors when doing bundle install, but when I try to rake db:migrate --trace this is the output:
rake aborted!
There was an error while trying to load the gem 'mysql2'.
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
/Users/redar/redar/config/application.rb:7:in `<top (required)>'
/Users/redar/redar/Rakefile:4:in `require'
/Users/redar/redar/Rakefile:4:in `<top (required)>'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/rake:23:in `load'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/rake:23:in `<main>'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `eval'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `<main>'
I don't know how to interpret this. Is there something wrong with the Rakefile?
Also, this is the output from the mkmf.log
EDIT: This is the content of my Rakefile, located at myapp/folder
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
MyApp::Application.load_tasks
Try
bundle exec rake db:migrate
This will make sure that you are executing "rake db:migrate" with the gems listed in the Gemfile loaded and available. If you run it without "bundle exec" you may be executing only with the system gems available.

uninitialized constant Rake::DSL

I met the problem 'uninitialized constant Rake::DSL'.
I have tried to add gem 'rake','0.8.7' in the Gemfile, but it didn't work out. Are there any other way to fix the problem? Thank you!
n177-p118:testapp shuang$ rake db:migrate --trace
(in /Users/shuang/rails/testapp)
rake aborted!
uninitialized constant Rake::DSL
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2503:in `const_missing'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/tasks/documentation.rake:11
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/tasks.rb:15:in `load'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/tasks.rb:15
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/tasks.rb:6:in `each'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/tasks.rb:6
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/application.rb:289:in `require'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/application.rb:289:in `initialize_tasks'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie.rb:184:in `instance_exec'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie.rb:184:in `load_tasks'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie.rb:184:in `each'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie.rb:184:in `load_tasks'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/engine.rb:424:in `load_tasks'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/application.rb:145:in `load_tasks'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `send'
/Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/shuang/rails/testapp/rakefile:8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:31
This is probably horribly bad form, but adding this to the top of my Rakefile worked for me:
module Rake
module DSL
end
end
Check your gemfile.lock, it must be having a version of rake which is > 0.8.7. If yes then delete all then delete all the instance of the version or delete all the content of gemfile.lock and then do bundle install again.
You can also try to run
bundle exec rake db:migrate

Not able to start Rails server

I am working on Ubuntu 10.04 LTS, Lucid Lynx, have installed Ruby on Rails 3 on it. I am not able to start Rails server. I am getting the following error.
mah#mah-laptop:~/Desktop/projects/ver$ rails s
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:29:in `block in <top (required)>': undefined method `root' for nil:NilClass (NoMethodError)
from /home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:27:in `tap'
from /home/mah/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.8/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I am using Rails 3.0.8 and rake version 0.8.7
I tried bundle exec but got same error.
Thanks for any help in advance
UPDATE
Here is what I get after bundle exec rake db:migrate --trace
mah#mah-laptop:~/Desktop/projects/ver$ bundle exec rake db:migrate --trace
rake aborted!
uninitialized constant Ver
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library'
/home/mah/Desktop/projects/ver/Rakefile:7:in `<top (required)>'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/mah/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/home/mah/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/home/mah/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'
This error means that Rails.application isn't initialized. I didn't actually know that, I
cheated.
So that then begs the question: how did you set up this application?
Perhaps this application doesn't contain a config/application.rb file that defines a class that inherits from Rails::Application and therefore is causing this problem. In my application here, I've got this one you could use as an example.

Resources