The latest Erubis (2.6.4) and Rails 2.2 (and 2.3) are still not compatible. The main issue is that the generated ruby code from Erubis uses "_buf" as the buffer variable and Rails 2.2 and 2.3 require "@output_buffer" to be used.
The reason for "@output_buffer" to be used is that ActionView helpers like CaptureHelper are designed around "@output_buffer" being the primary buffer in the generated code.
I have created a gem called elkinsware-erubis_rails_helper that fixes these issues and allows Erubis and Rails 2.3 (for sure but it should work for 2.2).
In your environment.rb file add:
config.gem 'erubis' , :version => '2.6.4'
config.gem 'elkinsware-erubis_rails_helper', :lib => 'erubis_rails_helper', :source => 'http://gems.github.com'
And then you can add a config/initializers/erubis_config.rb where you can adjust the Erubis/Rails options.
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
#Erubis::Helpers::RailsHelper.init_properties = {}
#Erubis::Helpers::RailsHelper.show_src = false
#Erubis::Helpers::RailsHelper.preprocessing = true
The source is at http://github.com/elkinsware/erubis_rails_helper/tree/master
Let me know if you have any issues with the gem.