# Handling content pages (CMS-like)

**URL:** <https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961>\
**Category:** Rails\
**Created:** [June 20, 2008, 7:17am UTC](https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961 "2008-06-20T07:17:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [June 20, 2008, 7:17am UTC](https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961/1 "2008-06-20T07:17:26Z")

</div>

Hello list,

I wonder how you guys handle content pages? Often described as “static”  
pages.

However, I don’t like to call them “static” because these pages often do  
use  
some minor dynamic content.

This is what I like to think of as the “website” part of the web  
application. Content that does not have complex logic behind it.

I had to handle it in the past, and at the time I just created a pages  
controller and each action would be a “page”. I would then create custom  
routes as alias to each page, such as:

map.connect “about-us”, :controller =\> “pages”, :action =\> “about\_us”

However, this new application has many more pages, and with rather  
complex  
hierarchies, for example:

[site.com/sales-solutions/fast-foods/photo-gallery](http://site.com/sales-solutions/fast-foods/photo-gallery)

(photo-gallery is exclusive, static, content-only sub-section of  
fast-foods  
and has nothing to do with a photo-gallery application other than  
advertising this service)

I’m not sure on how I could best handle situations like this. Maybe  
Rails  
has a CMS plugin or something that helps in managing static pages?

If you ever had to deal with a situation like this, please, share your  
experience and thoughts!

Any hints greatly appreciated!

Thanks,

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [June 22, 2008, 6:49pm UTC](https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961/2 "2008-06-22T18:49:52Z")

</div>

Marcelo de Moraes S. wrote:

> [http://site.com/sales-solutions/fast-foods/photo-gallery](http://site.com/sales-solutions/fast-foods/photo-gallery)
> 
> Any hints greatly appreciated!
> 
> Thanks,
> 
> Marcelo.

I use Radiant CMS. I haven’t yet needed to marry it with a Rails  
application but I believe it can be done - there are a couple of  
extensions for Radiant that support it.

Cheers,  
Mohit.  
6/23/2008 | 12:47 AM.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [June 23, 2008, 3:53pm UTC](https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961/3 "2008-06-23T15:53:26Z")

</div>

Thanks Mohit, I will definitely try Radiant,

But, I wonder, how do you handle the pages issues in your Rails  
applications?

Cheers,

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [June 24, 2008, 2:15am UTC](https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961/4 "2008-06-24T02:15:04Z")

</div>

To handle a limitless number of custom page urls, I use a catch-all  
route at the end of config/routes.rb:  
map.path ‘\*url’, :controller=\>‘paths’, :action=\>‘show’,  
:conditions=\>{:method=\>:get}

Custom urls using this route will be overridden by the other routes in  
routes.rb, and any files in public/ that match the url.

My paths controller manages Path objects, which use polymorphic  
belongs\_to relations to attach arbitrary paths (relative to my web-  
server root) to any displayable object (in my case, this includes  
things like Pages and Events).

My code for this is part of my Wayground project, viewable at:

> **[GitHub - grantneufeld/Wayground: Web content system based on Ruby on Rails.](https://github.com/grantneufeld/wayground/tree/master)**
>
> master

Of particular interest are:  
app/controllers/paths\_controller.rb  
app/controllers/pages\_controller.rb  
app/models/page.rb  
app/models/path.rb

I should probably pull my path handling stuff out into some sort of  
acts\_as\_custom\_url plug-in. Will post to this list if I do get around  
to that.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [June 24, 2008, 6:16am UTC](https://www.ruby-forum.com/t/handling-content-pages-cms-like/140961/5 "2008-06-24T06:16:44Z")

</div>

Thanks a lot for sharing, Grant.
