Feeling ashamed to even ask this.

3 views
Skip to first unread message

Neeraj Bagga

unread,
Nov 12, 2011, 6:30:43 PM11/12/11
to phil...@googlegroups.com, Conshoh...@googlegroups.com
Friends,

I started looking into RoR (again). I installed everything through RailsInstaller (The latest)
For some reason I am getting an error when I generating a scaffold. (THE MOST BASIC).

Following are the commands I ran
$> rails new demo2
$> cd demo2
$> rails generate controller welcome index
http://localhost:3000/welcome/index Works Just fine
$> rails generate scaffold Product title:string description:text
$> rake db:migrate
http://localhost:3000/product Gives me the following error

Routing Error

No route matches [GET] "/product"
Started GET "/product" for 127.0.0.1 at 2011-11-12 18:20:52 -0500
ActionController::RoutingError (No route matches [GET] "/product"):
Rendered C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.1.1/l
ib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues
/layout (1.0ms)

Any idea what I am doing wrong? Really feeling ashamed to even ask this. 



--
********************************************************************************
Disease free body, quiver free breath, stress free mind, inhibition free intellect, obsession free memory, ego that includes all and a Soul free from sorrow.


Adam

unread,
Nov 16, 2011, 9:04:37 AM11/16/11
to conshoh...@googlegroups.com
Neeraj,

Try hitting http://localhost:3000/products. Rails will automatically pluralize controller names and the corresponding route. In general it's a helpful case of convention over configuration. You can always check your config/routes.rb file to see what routes are configured if you are getting an error that says "no route matches".

Here's some more info on the pluralization:

Adam
Reply all
Reply to author
Forward
0 new messages