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.

Subscribe to our RSS feed


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