# Routes for simple static part of site

**URL:** <https://www.ruby-forum.com/t/routes-for-simple-static-part-of-site/128057>\
**Category:** Rails\
**Created:** [February 4, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/routes-for-simple-static-part-of-site/128057 "2008-02-04T18:02:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [February 4, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/routes-for-simple-static-part-of-site/128057/1 "2008-02-04T18:02:57Z")

</div>

I’ve created routes for the complex side of my web app, but I’m working  
on an ‘about us’ section which is completely static. I’m a little  
unsure as how the best way to do this and how the routes would be  
configured.

there is a button that says “LEARN (about us)”

the url would be:

[http://localhost:3000/learn](http://localhost:3000/learn)

then there would be three options:

who we are  
history  
staff profiles

and the urls should be

[http://localhost:3000/learn/who\_we\_are](http://localhost:3000/learn/who_we_are)  
[http://localhost:3000/learn/history](http://localhost:3000/learn/history)  
[http://localhost:3000/learn/staff\_profiles](http://localhost:3000/learn/staff_profiles)

Do I create a learn\_controller with 4 views files? index, who\_we\_are,  
history and staff\_profiles?

If so, how would I configure the routes?

Am i missing something?

---

<div class="post-metadata">

**Author:** ![jimmypalmer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jimmypalmer](https://www.ruby-forum.com/u/jimmypalmer)\
**Post date:** [February 4, 2008, 6:55pm UTC](https://www.ruby-forum.com/t/routes-for-simple-static-part-of-site/128057/2 "2008-02-04T18:55:30Z")

</div>

Jimmy

For static content

#1) it is always advisable to have webserver serve these kinda pages  
(About us, learn, help etc), I do not see any specific reason to serve  
static pages from app servers (e.g mongrel etc). Unless and untill you  
generate them dynamically or have few areas generating dynamic values  
within those pages.  
If you go by webserver route , This will make your site faster and  
better and less load on app server which is already doing dynamic data.  
I’m sure you know all this but that is just to express views on static  
vs dynamic data.

#2) second way is drop static files in your app server public directory  
, e.g /public folder and that’s it and Apache-\>mongrel will  
automatically serve the files, if you do not have apache and if you are  
using only app server on some port as you mentioned (3000) then also  
idea is same. drop static files in public folder and it shud work. the  
way routes works is ,

1. look at public static folder, if not found
2. look for dynamic data via controller-\>action route

#3) If at all you want to serve these page completely dynamic based on  
controllers. You can modify your routes in bunch of different ways

```
a) as you mentioned to have "learn" controller and then specific 

```

actions in that controller to serve page accordingly and have a default  
action in learn controller to serve a deafault page.

```
b) route learn to specific controller by changing routes like

  map.connect ':name', :controller => "<generic>", :action=> 

```

“”

where :name = can be anything , you can have anything in there , “learn”  
“help” etc, is a controller name, and is action  
name within that controlller. so everytime rails finds  
localhost:3000/ it will dispatches it to   
controller.

for detail on the last point check this url , good technique for these  
kinda things

[http://www.savedmyday.com/2007/11/07/screen-name-trick-in-rails-routes/](http://www.savedmyday.com/2007/11/07/screen-name-trick-in-rails-routes/)

Hope that helps

OpenWeb20:  
[http://messagedance.com/openweb20](http://messagedance.com/openweb20)

Jimmy P. wrote:

> I’ve created routes for the complex side of my web app, but I’m working  
> on an ‘about us’ section which is completely static. I’m a little  
> unsure as how the best way to do this and how the routes would be  
> configured.
> 
> there is a button that says “LEARN (about us)”
> 
> the url would be:
> 
> [http://localhost:3000/learn](http://localhost:3000/learn)
> 
> then there would be three options:
> 
> who we are  
> history  
> staff profiles
> 
> and the urls should be
> 
> [http://localhost:3000/learn/who\_we\_are](http://localhost:3000/learn/who_we_are)  
> [http://localhost:3000/learn/history](http://localhost:3000/learn/history)  
> [http://localhost:3000/learn/staff\_profiles](http://localhost:3000/learn/staff_profiles)
> 
> Do I create a learn\_controller with 4 views files? index, who\_we\_are,  
> history and staff\_profiles?
> 
> If so, how would I configure the routes?
> 
> Am i missing something?
