1

Trying to follow the "Ruby on Rails 3 Tutorial" and running rails s, getting the following error:

[path]\config.ru:1 in 'require': no such file to load -- fake_app

I've got the location of fake_app.rb in the PATH (which I presume is what rails/rack is trying to find)

Contents of config.ru are the default generated:

require "fake_app"

run Rack::Test::FakeApp

I am running rails 3.0.8 and Windows 7

Thanks for helping this complete novice out!

Zabba
  • 64,285
  • 47
  • 179
  • 207
Neil Singer
  • 11
  • 1
  • 2
  • 1
    You might try replacing your `require` line with `require ::File.expand_path('../config/environment', __FILE__)` and see if that works better? If that gets rid of your line 1 error, you might need to replace line 2 with `Run FakeApp::Application` – D. Simpson Jun 14 '11 at 02:32
  • BTW, my answer was well in the way of a "novice answer" -- I am no expert in the proper structure of the `config.ru` file, I just looked at my old Rails 3 Tutorial project directory and found that's how it was configured :-) – D. Simpson Jun 14 '11 at 02:42

1 Answers1

2

Did you generate this with rails new [appname] command? A default Rails 3.0 config.ru file should look more like this:

require ::File.expand_path('../config/environment', __FILE__)
run ApplicationName::Application

If all you've done at this point is install Ruby and Rails, I'd re-run the generator to get something that works.

Also, since you're on Windows, I wanted to recommend Rails Installer for your environment installation and setup. It mitigates a lot of the startup pain.

This is probably the tutorial you are speaking of, but I also highly recommend Michael Hartl's Ruby on Rails Tutorial for a solid introduction to Rails 3. The section about generating your first application may be handy in this situation.

krohrbaugh
  • 1,324
  • 9
  • 11
  • Yes, the config.ru was generated with rails new [appname] . Not sure why I'm not getting the standard default. Also, yes, its the Hartl tutorial I'm following. Will try the Rails Installer. – Neil Singer Jun 15 '11 at 00:12
  • Sorry to be dense, but if the app name is demo_app and I run: rails new demo_app how should I expect config.ru to read? – Neil Singer Jun 15 '11 at 00:13
  • The same `require` line as listed in my answer, with the last line being `run DemoApp::Application`. – krohrbaugh Jun 15 '11 at 03:37
  • Still did not work under Windows native for some reason. Although your answers are exactly right. Finally ended up going with Cygwin and running rails there. Problem resolved. Thanks – Neil Singer Jun 16 '11 at 01:33