Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is this basic Rails 3 route not working?
    text
    copied!<p>I've just upgraded to Rails 3, and decided to take it for a whirl with a dummy/sandbox app. The strange thing is I can't seem to get <em>any</em> routes to work!</p> <p>Here's my problem:</p> <pre><code>[cobychapple@shiva:Dev]$rails new TestApp create create README create Rakefile ... [cobychapple@shiva:Dev]$cd TestApp/ [cobychapple@shiva:TestApp]$rails g scaffold widget name:text invoke active_record create db/migrate/20101020115518_create_widgets.rb create app/models/widget.rb ... [cobychapple@shiva:TestApp]$rake db:migrate (in /Users/cobychapple/Dev/TestApp) == CreateWidgets: migrating ================================================== -- create_table(:widgets) -&gt; 0.0015s == CreateWidgets: migrated (0.0016s) ========================================= [cobychapple@shiva:TestApp]$rake routes (in /Users/cobychapple/Dev/TestApp) widgets GET /widgets(.:format) {:action=&gt;"index", :controller=&gt;"widgets"} widgets POST /widgets(.:format) {:action=&gt;"create", :controller=&gt;"widgets"} new_widget GET /widgets/new(.:format) {:action=&gt;"new", :controller=&gt;"widgets"} edit_widget GET /widgets/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"widgets"} widget GET /widgets/:id(.:format) {:action=&gt;"show", :controller=&gt;"widgets"} widget PUT /widgets/:id(.:format) {:action=&gt;"update", :controller=&gt;"widgets"} widget DELETE /widgets/:id(.:format) {:action=&gt;"destroy", :controller=&gt;"widgets"} [cobychapple@shiva:TestApp]$rails s -d =&gt; Booting WEBrick =&gt; Rails 3.0.1 application starting in development on http://0.0.0.0:3000 [cobychapple@shiva:TestApp]$ </code></pre> <p>So now I head on over to my browser and visit <a href="http://localhost:3000/widgets" rel="nofollow">http://localhost:3000/widgets</a></p> <p>Rails says: Routing Error: No route matches "/widgets"</p> <p>I don't get how rake routes can show the route exists and then the server won't match it. I've googled a whole bunch and there seems to be a few people with routing issues in rails 3, but none of them are as apparently basic as what I'm getting. I'm sure I've just missed something small along the way but I can't for the life of me figure it out! Any suggestions?</p> <p>My routes.rb file is only what that scaffold generates + documentation comments:</p> <pre><code>TestApp::Application.routes.draw do resources :widgets # The priority is based upon order of creation: # skip the rest of the comments... end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload