# Help on Route

**URL:** <https://www.ruby-forum.com/t/help-on-route/193098>\
**Category:** Rails\
**Created:** [August 11, 2010, 7:28am UTC](https://www.ruby-forum.com/t/help-on-route/193098 "2010-08-11T07:28:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![railsfan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@railsfan](https://www.ruby-forum.com/u/railsfan)\
**Post date:** [August 11, 2010, 7:28am UTC](https://www.ruby-forum.com/t/help-on-route/193098/1 "2010-08-11T07:28:27Z")

</div>

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

Thank you

---

<div class="post-metadata">

**Author:** ![railsfan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@railsfan](https://www.ruby-forum.com/u/railsfan)\
**Post date:** [August 11, 2010, 7:47am UTC](https://www.ruby-forum.com/t/help-on-route/193098/2 "2010-08-11T07:47:39Z")

</div>

Tony Yin wrote:

> 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
> 
> Thank you

Try this,

map.resources :controller\_name, :collection =\> { :method\_name =\> :get }

Thanks,  
Anubhaw

---

<div class="post-metadata">

**Author:** ![railsfan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@railsfan](https://www.ruby-forum.com/u/railsfan)\
**Post date:** [August 11, 2010, 7:57am UTC](https://www.ruby-forum.com/t/help-on-route/193098/3 "2010-08-11T07:57:09Z")

</div>

Anubhaw P. wrote:

> Tony Yin wrote:
> 
> > 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
> > 
> > Thank you
> 
> Try this,
> 
> map.resources :controller\_name, :collection =\> { :method\_name =\> :get }
> 
> Thanks,  
> Anubhaw

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.

---

<div class="post-metadata">

**Author:** ![railsfan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@railsfan](https://www.ruby-forum.com/u/railsfan)\
**Post date:** [August 11, 2010, 8:08am UTC](https://www.ruby-forum.com/t/help-on-route/193098/4 "2010-08-11T08:08:28Z")

</div>

Tony Yin wrote:

> Anubhaw P. wrote:

> > Try this,
> > 
> > map.resources :controller\_name, :collection =\> { :method\_name =\> :get }
> > 
> > Thanks,  
> > Anubhaw
> 
> 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’.

Thanks,  
Anubhaw
