Using the .erb extension for emails

Past month, Bemba.com was succesfully transitioned to Rails 2.0. One thing remained to do: the emails in the system. My initial change resulted in errors. Now I know why.

You see, in Rails 2 the extension for view files is .html.erb instead of .rhtml. This makes sense for regular html pages, but not so much for plain text emails. After all, you’d expect to name these .txt.erb.

It turns out that didn’t work at all. Instead of plain text emails I got a bunch of errors in my unit tests. So i rolled back the change and procrastinated postponed this change.

It turns out the fix is easy.

The errors were caused not by Rails itself, but the Globalize plugin. This plugin parses the filenames of emails and tries to match one of the installed languages. This way you can have English-language emails and Espagnol for your Spanish users. But the plugin isn’t aware of all them newfangled .erb extensions and boomed out.

The fix then? Just drop everything besides .erb. Nobody’s confused and my tests are happy.

Transition to Rails 2 …. done.

0 Responses to “Using the .erb extension for emails”


  1. No Comments

Leave a Reply




About Bemba Media

Bemba Media is a new social media company based in Amsterdam, the Netherlands. Founders Aaron Peters and Arne Dibbits are on a mission to offer people the easiest way to share their web experiences with friends and to discover what’s hot on the web right now.

The company launched Bemba.com in March 2008.

Bemba users share their favorite videos and websites on the social platforms they already use with their friends, like Facebook, Twitter and Hyves. More social networks and (micro-) blogs will follow.

Bemba will become a destination for 'funsurfing' the web, providing easy access to web content that people with similar interests have recently recommended to their friends.

Flickr photos

meeting with Sanoma NL in Hoofddorp #

Bemba blog in Wordle

More Photos

Twitter updates

    Recent readers