I will explain myself (probably) on my next post why I have not been active on blogging. But for now, I want to share with you how I coded in Ruby on Rails to render static pages. It has been only two days when I really started Ruby on Rails coding, so I might (not) appreciate your sarcasm.
Let me show you the code in cakephp how it does its rendering of static pages:
function display() {
$path = func_get_args();
if (!count($path)) {
$this->redirect(‘/’);
}$count = count($path);
$page = $subpage = $title = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title = Inflector::humanize($path[$count - 1]);
}
$this->set(compact(‘page’, ‘subpage’, ‘title’));
$this->render(join(‘/’, $path));
}
{/code}
In Ruby on Rails, I coded it this way:
{code type=ruby}
def index()
@page = params[: page]
render :template => ‘pages/’+params[: page]
end
{/code}
(Excuse the space between the colon (“:”) and the “p”, they are translated as emoticons in wordpress.)
Dont forget in routes.rb also, to put:
map.connect ‘:controller/: page’
If you think of a better way, I am open to your advice, suggestions.
Note: @page may serve as a page title for you. for other controllers , put in before_filter :actionname and
in that action place a value in @page.


There is an example on how to use rails to create a static site in http://usefulfor.com/ruby/2009/02/04/use-rails-to-create-a-static-site/
Hope it helps