# Page layouts / general site layout with RoR

**URL:** <https://www.ruby-forum.com/t/page-layouts-general-site-layout-with-ror/82523>\
**Category:** Rails\
**Created:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/page-layouts-general-site-layout-with-ror/82523 "2007-01-19T16:31:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/page-layouts-general-site-layout-with-ror/82523/1 "2007-01-19T16:31:07Z")

</div>

Hi,

I’m pretty new to the whole RoR thing (coming from a .NET background)  
and have gone through some tutorials both in books and online.

In the tutorials the controllers / views make sense. But suppose I have  
a layout, images, CSS, etc my designer has given me. The index or home  
page has some general info, and might have some dynamic info coming  
from the database.

The question I have is - do I create a controller just for this page?  
It’s not a page that is simply listing records, or a data entry screen  
for a table (as you see in tutorials). It’s a page with dynamic data  
coming from possibly multiple pages.

So what’s the recommendation here?

Thanks in advance!  
-Keith

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 25, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/page-layouts-general-site-layout-with-ror/82523/2 "2007-09-25T22:32:42Z")

</div>

If you do want dynamic data on the page, then yup, you need to create  
a controller. Many of us create a content\_controller.rb for static  
pages. You can then specify routes that pretty up the URLs to the  
actions for this controller – e.g., map.connect ‘’, :controller =\>  
‘content’, :action =\> ‘index’ would make the / path load the index  
action of the controller (assuming public/index.html has been removed).

If the page is completely static, you can place the content in public/  
index.html instead. The downside to this approach is that you have  
to duplicate the application layout in the file itself – it won’t be  
able to use any layouts in app/views/layouts.

–  
Building an e-commerce site with Rails?  
[http://www.agilewebdevelopment.com/rails-ecommerce](http://www.agilewebdevelopment.com/rails-ecommerce)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [September 25, 2007, 10:32pm UTC](https://www.ruby-forum.com/t/page-layouts-general-site-layout-with-ror/82523/3 "2007-09-25T22:32:42Z")

</div>

Thanks for pointing me in the right direction Benjamin.

For anyone else that might have this newbie question, I googled  
‘routes’ and happened across this page that explains it a little  
further:

[http://www.paulsturgess.co.uk/articles/show/27](http://www.paulsturgess.co.uk/articles/show/27)
