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 any routes to work!
Here's my problem:
[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)
-> 0.0015s
== CreateWidgets: migrated (0.0016s) =========================================
[cobychapple@shiva:TestApp]$rake routes
(in /Users/cobychapple/Dev/TestApp)
widgets GET /widgets(.:format) {:action=>"index", :controller=>"widgets"}
widgets POST /widgets(.:format) {:action=>"create", :controller=>"widgets"}
new_widget GET /widgets/new(.:format) {:action=>"new", :controller=>"widgets"}
edit_widget GET /widgets/:id/edit(.:format) {:action=>"edit", :controller=>"widgets"}
widget GET /widgets/:id(.:format) {:action=>"show", :controller=>"widgets"}
widget PUT /widgets/:id(.:format) {:action=>"update", :controller=>"widgets"}
widget DELETE /widgets/:id(.:format) {:action=>"destroy", :controller=>"widgets"}
[cobychapple@shiva:TestApp]$rails s -d
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
[cobychapple@shiva:TestApp]$
So now I head on over to my browser and visit http://localhost:3000/widgets
Rails says: Routing Error: No route matches "/widgets"
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?
My routes.rb file is only what that scaffold generates + documentation comments:
TestApp::Application.routes.draw do
resources :widgets
# The priority is based upon order of creation:
# skip the rest of the comments...
end