So, I’ve been trying to get Erubis working on Rails 2.2.2 as part of my job at Yellowpages. Apparently this is something no one told the internet to take care of for me when the latest release of Rails (2.2.2) came out. So now its time to unravel the onion.
I’ve actually gotten the thing working, but only in development mode. Production mode is not so happy. However, in honor of full disclosure and knowledge sharing, I’m providing the code I have so far.
The hooks for the Erubis code into rails is in a file called rails_helper.rb, I was able to drop all of my code here. The diff I have should get you running Erubis 2.6.2 in development mode. However, precompilation (used in production mode) fails, so this is of less help.
The problem I’m havoing is that the view object is no longer available to TemplateHandlers. I can hack the code (_pick_template in ActionView::Base) to have the view available, however, I haven’t been able to shove it in there when Rails precompiles templates.
The whole thing could be a waste of time. I’ve done some testing, and I can’t really see any performance difference between ERB in Rails 2.1.1, 2.2.2, and Erubis 2.6.2 on Rails 2.1.1. (yikes). There does seem to be less IO with Erubis, but otherwise, I’m not sure yet that its even worth it.
Anyone else out there have experience either getting this working or discovering the performance difference is nil or negligible?


