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?



Holy god, that’s ugly. Unless Erubis is updated to Rail 2.2-ish, it’s not going to be used very much.
Please let me know if you manage to get it working — I’m not interested in being tied to an older version for the sake of Erubis…
Comment by Will Sargent — February 17, 2009 @ 3:59 am
Yes, yes it is. Making just the dev mode work can be much cleaner, but just as worthless. I’ll update this later after I progress some more.
Comment by kleinptr — February 17, 2009 @ 4:34 am
Just passing by.Btw, your website have great content!
_________________________________
Making Money $150 An Hour
Comment by Mike — March 1, 2009 @ 2:48 pm