hi, I'm new to rails, trying to setup a simple site, in my routes.rb I
have map.root :controller => 'site' , and in my app/controller I have
defined site_controller.rb with action index and about. When I start up
the server, I can see my index on localhost:3000 as the default index,
but when I try to access localhost:3000/about, it gives my a routing
error saying "No route matches "/about" with {:method=>:get}".
Please help
hi, I'm new to rails, trying to setup a simple site, in my routes.rb I
have map.root :controller => 'site' , and in my app/controller I have
defined site_controller.rb with action index and about. When I start up
the server, I can see my index on localhost:3000 as the default index,
but when I try to access localhost:3000/about, it gives my a routing
error saying "No route matches "/about" with {:method=>:get}".
Please help
hi, I'm new to rails, trying to setup a simple site, in my routes.rb I
have map.root :controller => 'site' , and in my app/controller I have
defined site_controller.rb with action index and about. When I start up
the server, I can see my index on localhost:3000 as the default index,
but when I try to access localhost:3000/about, it gives my a routing
error saying "No route matches "/about" with {:method=>:get}".
Please help
hi Anubhaw, thanks for the reply, but that did not work. When I put that
in
my routes.rb, I lost home index; but I can view index from
localhost:3000/site. But when I try to view localhost:3000/about it
gives me an error message Unknown action
No action responded to show. Actions: about, help, and index
So it appears something is not connecting, even though I specified the
action name and the action is defined in my controller.
hi Anubhaw, thanks for the reply, but that did not work. When I put that
in
my routes.rb, I lost home index; but I can view index from
localhost:3000/site. But when I try to view localhost:3000/about it
gives me an error message Unknown action
No action responded to show. Actions: about, help, and index
So it appears something is not connecting, even though I specified the
action name and the action is defined in my controller.
Hi Tony,
Site is your controller name.
If you need to access a method from controller, the url should be like
this
'localhost:3000/site/about'.
When you hit 'localhost:3000/site' the actual url is
'localhost:3000/site/index'.
So in link to you need to specify controller name and action name.
If you need the url like localhost:3000/about, you need to specify
following in route:-
map.connect '/about', :controller => 'site', :action => 'about'.