[Sdruby] Better solutions for page titles?

Patrick Crowley patrick at mokolabs.com
Fri Feb 23 22:19:42 GMT 2007


Oooh. If you shorten the helper name to "t", you get some nice  
syntactic sugar.

## helpers/application_helper.rb
   def t(title)
     @title = title
     return @title
   end

## site/getting_started.rhtml
<h1><%=t "Getting started" %></h1>
<title>chumby</title>

I like this approach because it mimics the html safe method(#h). And,  
if you've got designers or other folk editing templates, it's easily  
explained.

Mr. T says, "Use my method, fool!"

-- Patrick




More information about the Sdruby mailing list