June 2008 Archive

Undefined method ‘capture_erb_with_buffer’

June 21st, 2008

I just ran into this issue when starting a new rails project, and attempting to use the script/generate resource generator. You might get an error like this:

/Library/Ruby/Gems/1.8/gems/haml-2.0.0/lib/haml/helpers/action_view_mods.rb:46:in `alias_method': undefined method `capture_erb_with_buffer' for module `ActionView::Helpers::CaptureHelper' (NameError)

If you do, the solution is to open up that file (action_view_mods.rb) in a text editor and find the lines:


        alias_method :capture_erb_with_buffer_without_haml, :capture_erb_with_buffer
        alias_method :capture_erb_with_buffer, :capture_erb_with_buffer_with_haml

And change them to:


        alias_method :capture_erb_with_buffer, :capture_erb_with_buffer_with_haml
        alias_method :capture_erb_with_buffer_without_haml, :capture_erb_with_buffer

For some reason it was referencing an aliased method before it aliased it.