# Basic mini cms

**URL:** <https://www.ruby-forum.com/t/basic-mini-cms/135588>\
**Category:** Rails\
**Created:** [April 23, 2008, 11:59am UTC](https://www.ruby-forum.com/t/basic-mini-cms/135588 "2008-04-23T11:59:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [April 23, 2008, 11:59am UTC](https://www.ruby-forum.com/t/basic-mini-cms/135588/1 "2008-04-23T11:59:59Z")

</div>

Mini CMS

I tend to follow a very similar pattern when setting up small websites  
for people. Basically itâ€™s like this for an example site with three  
pages. Two controllers, Welcome and Pages.

* * *

The Welcome controller is simple contains the following really.

It contains a â€œfind\_byâ€ method to find the page content by the name of  
the action. I use a before filter to do this before each action.

def home  
end

def contact  
end

def links  
end

* * *

Views

all contain the same thing.

If thereâ€™s page content â€“ display it.

Pages controller just a normal scaffolded controller to CRUD pages. The  
title of the page is used as the key to link content to the pages so it  
needs to match the action names. I set up all my pages in the initial  
migration with some dummy content. I use the new basic  
http\_authentication built into rails 2 to secure this controller.

Then I have a layout for the welcome which generates a menu at the top  
with links to each action, I need to update this by hand as pages change  
name or are added or deleted.

Basically my approach works fine, just wondering if others use the same  
type of approach and looking for tips to refine this!

A page in my database is again simple title:string, body:text

Tips appreciated.

Cheers

bsp

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [April 24, 2008, 10:34am UTC](https://www.ruby-forum.com/t/basic-mini-cms/135588/2 "2008-04-24T10:34:20Z")

</div>

Anyone on this. Sorry if I’m a little unclear.

Just interested in how others might create a very basic website for  
people with a backend CMS.

The layout file is where I set out my navigation menus, and I need to  
edit this if the “client” changes the site structure.

Sometimes I use “tinymce” to allow the client to format text without  
having to learn basic html.

workflow is roughly.

1. create welcome controller with actions and views for each page
2. create pages scaffolded controller
3. add a page record for each page and some dummy content
4. edit layout for navigation menu
5. edit welcome views to include the page records “content”

Am I missing a trick or two?

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [April 23, 2008, 1:30pm UTC](https://www.ruby-forum.com/t/basic-mini-cms/135588/3 "2008-04-23T13:30:37Z")

</div>

Any tips?

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [April 25, 2008, 12:50pm UTC](https://www.ruby-forum.com/t/basic-mini-cms/135588/4 "2008-04-25T12:50:16Z")

</div>

Michael S. wrote:

> In the Learning Rails screencast series, we’re building up a mini-CMS  
> as an example. You can download our code and see the screencasts that  
> walk through it. We don’t use separate actions for each page, but  
> treat the Page as a restful resource and use the name of the page to  
> find the appropriate page contents. We made a separate “viewer”  
> controller to render the page so we could keep the page\_controller as  
> the standard scaffolded REST controller.
> 
> [http://www.BuildingWebApps.com/learningrails](http://www.BuildingWebApps.com/learningrails)
> 
> There’s three screencasts posted now, which create the basic Page  
> model and then add user authentication. The fourth screencast, which  
> will be published Monday, allows pages to be set as admin access only  
> and also automatically creates the navigation. We’ll be further  
> enhancing it in the next couple screencasts.
> 
> Michael S.  
> [www.BuildingWebApps.com](http://www.BuildingWebApps.com)
> 
> On Apr 24, 1:34 am, bingo bob [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Michael,

Your site is a wonderful resource, I listened to the audio stuff this  
morning and it really helped cement my knowledge.

I’ve subscribed and I’ll be tuning in.

I liked the IDE/simple editor debate. For the record I’m a textmate man,  
:-).

cheers

bb

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [April 25, 2008, 12:35am UTC](https://www.ruby-forum.com/t/basic-mini-cms/135588/5 "2008-04-25T00:35:29Z")

</div>

In the Learning Rails screencast series, we’re building up a mini-CMS  
as an example. You can download our code and see the screencasts that  
walk through it. We don’t use separate actions for each page, but  
treat the Page as a restful resource and use the name of the page to  
find the appropriate page contents. We made a separate “viewer”  
controller to render the page so we could keep the page\_controller as  
the standard scaffolded REST controller.

[http://www.BuildingWebApps.com/learningrails](http://www.BuildingWebApps.com/learningrails)

There’s three screencasts posted now, which create the basic Page  
model and then add user authentication. The fourth screencast, which  
will be published Monday, allows pages to be set as admin access only  
and also automatically creates the navigation. We’ll be further  
enhancing it in the next couple screencasts.

Michael S.  
[www.BuildingWebApps.com](http://www.BuildingWebApps.com)

On Apr 24, 1:34 am, bingo bob [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
