-2

SO,

Paid for the PDF a few hours ago, followed the instructions carefully but after starting up first_app I see this in localhost:3000:

Routing Error

No route matches [GET] "/"

Haven't touched any code, just started up the server after doing "rails new first_app".

From the command-line:

552 ~/Downloads/rails_projects/first_app>=> Booting WEBrick
=> Rails 3.1.0.rc6 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Sprockets::Environment#static_root is deprecated
[2011-08-20 16:44:40] INFO  WEBrick 1.3.1
[2011-08-20 16:44:40] INFO  ruby 1.9.2 (2011-07-09) [x86_64-darwin10.8.0]
[2011-08-20 16:44:40] INFO  WEBrick::HTTPServer#start: pid=97719 port=3000

552 ~/Downloads/rails_projects/first_app>cache: [GET /] miss

Started GET "/" for 127.0.0.1 at 2011-08-20 16:45:06 -0400

ActionController::RoutingError (No route matches [GET] "/"):

Rendered /Users/briano/.rvm/gems/ruby-1.9.2-p290@rails3.1/gems/actionpack-3.1.0.rc6
/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within 
rescues/layout (7.3ms)

Using rails 3.1 and ruby 1.9.2:

554 ~/Downloads/rails_projects/first_app>rails -v
Rails 3.1.0.rc6
555 ~/Downloads/rails_projects/first_app>ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

Using rvm, created a special gemset, and so on. Any thoughts?

lucapette
  • 20,564
  • 6
  • 65
  • 59
Brian O.
  • 9
  • 1
  • 1
  • Right. Actually bought the Rails 3 tutorial. Let's be clear: this error is not the fault of the tutorial. – Brian O. Aug 21 '11 at 01:25
  • Your post doesn't show what command you issued to start your server. Did you issue `rails server`? – Tass Jun 28 '13 at 16:28

4 Answers4

1

The server is trying to use a caching mechanism (since it's in production mode).

Try running it in development.

This question has a bunch of answers for how to run your app in production (simply, replace their solutions with development).

Community
  • 1
  • 1
bias
  • 1,467
  • 3
  • 19
  • 39
0

Even i faced the same problem. The possible issue might be you are running the rails server on different app directory. Try to run your rails server from the same path as your app.

rajkumarts
  • 399
  • 1
  • 7
  • 20
0

Have you tried creating a new app and again running rails server command? do get back to me with the answer..

Morpheus
  • 3,285
  • 4
  • 27
  • 57
  • Morpheus, yes I have. I've tried a few different things so far (keep in mind, Snow Leopard, 10.6.8): hand-build ruby in /usr/local and use gem to install, use rvm and its ruby and gem, currently using Homebrew and its gems. In all cases I get the same result. Of course I always remove the "old" ruby and gems, I also create first_app anew each time I've installed a new ruby. I've also removed ruby and rails from an old 10.5 SDK in /Developer/SDKs. Basically trying each time to only have a single ruby and set of gems no matter what, but I get exactly the same error each time. – Brian O. Aug 29 '11 at 15:09
  • Current versions: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0], Rails 3.0.10. A friend of mine of who does a lot of rails dev. played with my laptop too, he was mystified. Other things I've done: removed everything from .bash_profile and re-sourced to check if some odd ENV was the problem, edited /etc/hosts.... – Brian O. Aug 29 '11 at 15:16
  • i dont know man even i am new to rails..hope you will find a solution – Morpheus Aug 29 '11 at 15:35
0

I assumed this was from the demo app. The first app has no controllers, so something is broken but you will see this again in the second, demo_app in the first app, try uncommenting /# root :to => 'welcome#index' and make sure that the index.html file is in public.

When you see this in the demo_app: You have no route for the main app, or "root" of the app.
If you change the address to http://localhost:3000/users, the index action, which is an
html Get for users will display all your users, which at this point is none.
To fix the problem, you need to add a route to the main url or root (http://localhost:3000).
If you type "rake routes", you see that there are routes for users but no route for root.

Open the config/routes.rb file near the bottom, change the line: /# root :to => 'welcome#index' to: root :to => 'users#index'

users#index is the same as the first route from rake routes.

{:action=>"index", :controller=>"users"}

You have changed the default action to go to users controller and the index action. Rake routes now shows an entry for root.

ForceMagic
  • 6,230
  • 12
  • 66
  • 88
TW Scannell
  • 189
  • 1
  • 4