# Simple Controller/Routes Question

**URL:** <https://www.ruby-forum.com/t/simple-controller-routes-question/58397>\
**Category:** Rails\
**Created:** [April 21, 2006, 6:27am UTC](https://www.ruby-forum.com/t/simple-controller-routes-question/58397 "2006-04-21T06:27:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 21, 2006, 6:27am UTC](https://www.ruby-forum.com/t/simple-controller-routes-question/58397/1 "2006-04-21T06:27:33Z")

</div>

This is probably a very basic question, but what is the proper  
controller & routing setup if I’m setting up a RoR site with static  
pages, like:

[http://mysite.com/about](http://mysite.com/about)  
[http://mysite.com/services](http://mysite.com/services)  
[http://mysite.com/contact](http://mysite.com/contact)

I want each of these pages to use a single template file that I can push  
content to. It seems like overkill to create individual controllers for  
about, services, and contact, so what is the best way to set this up?

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 21, 2006, 6:38am UTC](https://www.ruby-forum.com/t/simple-controller-routes-question/58397/2 "2006-04-21T06:38:47Z")

</div>

You either configure routes mapping (routes.rb) and use just one  
controller  
and define in each action a diferent template with the render command or  
you  
create differnt controllers, which is much simpler.

It mainly depends on how you want to group things together.

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 21, 2006, 7:16am UTC](https://www.ruby-forum.com/t/simple-controller-routes-question/58397/3 "2006-04-21T07:16:04Z")

</div>

Brandon S. wrote:

> This is probably a very basic question, but what is the proper  
> controller & routing setup if I’m setting up a RoR site with static  
> pages, like:
> 
> [http://mysite.com/about](http://mysite.com/about)  
> [http://mysite.com/services](http://mysite.com/services)  
> [http://mysite.com/contact](http://mysite.com/contact)
> 
> I want each of these pages to use a single template file that I can push  
> content to. It seems like overkill to create individual controllers for  
> about, services, and contact, so what is the best way to set this up?

What I’ve done is create a simple controller called “site” which will  
group all my contact/about/privacy terms/etc pages together. Then I use  
routes to direct “/about” to “/site/about”:

```
map.contact '/contact', :controller => 'site', :action => 'contact'
map.about '/about', :controller => 'site', :action => 'about'
map.terms '/terms', :controller => 'site', :action => 'terms'
map.privacy '/privacy', :controller => 'site', :action => 'privacy'

```

Jeff C.man

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 21, 2006, 7:22am UTC](https://www.ruby-forum.com/t/simple-controller-routes-question/58397/4 "2006-04-21T07:22:00Z")

</div>

Jeff C.man wrote:

> What I’ve done is create a simple controller called “site” which will  
> group all my contact/about/privacy terms/etc pages together. Then I use  
> routes to direct “/about” to “/site/about”:
> 
> map.contact ‘/contact’, :controller =\> ‘site’, :action =\> ‘contact’  
> map.about ‘/about’, :controller =\> ‘site’, :action =\> ‘about’  
> map.terms ‘/terms’, :controller =\> ‘site’, :action =\> ‘terms’  
> map.privacy ‘/privacy’, :controller =\> ‘site’, :action =\> ‘privacy’
> 
> Jeff C.man

Jeff… awesome! That sounds like a good solution. I’ll try it out.

---

<div class="post-metadata">

**Author:** ![deniedlates](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/13edae/32.png) [@deniedlates](https://www.ruby-forum.com/u/deniedlates)\
**Post date:** [April 21, 2006, 7:19am UTC](https://www.ruby-forum.com/t/simple-controller-routes-question/58397/5 "2006-04-21T07:19:35Z")

</div>

Roberto,

Thanks for the info… I would like to have one design template and push  
content from each page to the template, so it seems like the single  
controller is the way to go… does anyone have other thoughts?

Brandon
