Routing problem for Rails 2 newbie

I’m running:
WinXP-Pro/SP3
Rails 2.3.5
MySQL 5.0.37-community-nt
Firefox 3.6 browser
Mongrel web server

I have a Rails 2 app that initially brought up the Welcome screen

I ran:
ruby script/generate scaffold vendor nickname:string
qbname:string

I discovered that config\routes.ruby.rb now starts out:
ActionController::Routing::Routes.draw do |map|
map.resources :vendors

Following the advice of routes.rb, I renamed public\index.html by
appending “-renamed”

When I give the browser http://localhost:3000/, I get:
Routing Error
No route matches “/” with {:method=>:get}

So the map.resources :vendors is not enough to get to:
app\controllers\application_controller.rb and
app\views\vendors\something-or-other

Suggestions greatly appreciated.

Thanks in Advance,
Richard

Hi,

With that configuration in routes.rb you have to go to
http://localhost:3000/vendors to get to your index action of the
controller.

If you want to go directly you need to add map.root :controller =>
‘vendors’, :action => ‘index’ to your routes.rb

I hope that helps.

That was perfect. I studying an on-line tutorial on REST, but its
slow going. Thanks for help to get my Rails app to run.

Restarting the server might do the trick in most cases

at the app level,

“ruby script/server”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs