Four Seasons, One Tree (via xj_effektz, via Best Pic Ever)

Lord, you will grant us peace; all we have accomplished is really from you.
Isaiah 26

Easy titles in Rails

application_helper.rb

def site_title; "Acme Widgets Corp"; end
def t(str); textilize_without_paragraph(@title = str); end
def title; @title.blank? ? site_title : "#{@title} - #{site_title}"; end

some_action.html.erb

<h1><%= t "Omnivorous Widgets" %></h1>

application.html.erb

<title><%= title %></title>

Oh, the protestations

I can hear it now, “But… but… it’s all hard-coded!”

Yes. Yes, it is. But it’s three lines, easy to remember, easy to change, distinctly non-clever, and very, very DRY.

Apparently it is good not to marry (Matt 19:12, 1 Cor 7), but I’m not so sure that’s my particular gift. Comic from xkcd.