If you went with erb templates you could put this logic actually in the template file, but some people don't like logic in template files, so it is your call.