Forum: Ruby on Rails Page layouts / general site layout with RoR

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
(Guest)
on 2007-01-19 17:31
(Received via mailing list)
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
Benjamin C. (Guest)
on 2007-09-26 00:32
(Received via mailing list)
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
(Guest)
on 2007-09-26 00:32
(Received via mailing list)
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
This topic is locked and can not be replied to.