Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionView::TemplateHandlers::ERB.erb_trim_mode= broken

#2553

Adding

{{{ ActionView::TemplateHandlers::ERB.erb_trim_mode = '%-' }}}

to config/initializers/liveops.rb yields:

{{{ /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/class/attribute_accessors.rb:37:in erb_trim_mode=': can't modify frozen class/module (TypeError)

    from /var/home/josb/src/ops/trunk/www/main/config/initializers/liveops.rb:8
    from /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
    from /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load'
    from /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /opt/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load'
    from /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:600:in `load_application_initializers'
    from /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:599:in `each'
    from /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:599:in `load_application_initializers'
     ... 9 levels...
    from /opt/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
    from /opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /opt/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from /home/josb/src/ops/trunk/www/main/script/server:3

}}}

Reported by Jos Backus · April 23rd, 2009 @ 10:27 PM

State: stale
Milestone: 2.3.10
Assigned to: nobody
Importance: Low

Activity

  1. CancelProfileIsBroken
  2. Rizwan Reza
    Rizwan Reza
    • Tag changed from bugmash to 2.3.x, actionview, bugmash, config, configuration, erb

    verified

    +1 This bug is still there in 2-3-stable but not in master branch.

    August 8th, 2009 @ 02:08 PM

  3. Dan Pickett
    Dan Pickett

    +1 verified - although I believe we should come up with a better way to adjust this.

    I'm trying to track down where the class is frozen

    August 8th, 2009 @ 05:39 PM

  4. Dan Pickett
    Dan Pickett

    tracing this down it has to do with memoization - it looks like line 211 (load!) of actionpack/lib/template.rb

    sorry I couldn't trace it down further

    August 8th, 2009 @ 06:00 PM

  5. John Pignata
  6. sr.iniv.t
    sr.iniv.t

    +1 verified. Issue reproducible on 2-3-stable.

    September 27th, 2009 @ 05:53 AM

  7. Elad Meidar
    Elad Meidar

    +1 verified on 2-3-stable indeed, but not on master... Obviously Dan is right, the freeze occurs on load, which is before the initializers are run... hence the error.

    i can't help to think that maybe if it will be called in another way.... i successfully tried

    # initializers/erb_trim.rb
    
    class ActionView::Base
      class_variable_set :@@erb_trim_mode, '-%'
    end
    

    September 27th, 2009 @ 06:27 AM

  8. Kieran P
    Kieran P

    +1 verified I'm with Elad and Dan for finding a better way to set this though.

    September 27th, 2009 @ 07:12 AM

  9. Rizwan Reza
    Rizwan Reza
    • Tag changed from 2.3.x, actionview, bugmash, config, configuration, erb to 2.3.x, actionview, config, configuration, erb
    • State changed from new to open

    January 21st, 2010 @ 07:36 AM

  10. Rizwan Reza
    Rizwan Reza
    • Milestone changed from 2.x to 2.3.6

    January 21st, 2010 @ 07:36 AM

  11. niklas
    niklas

    the workaround suggested by Elad didn't work for me on 2.3.5. I had to use:

    gem 'actionpack', "=#{RAILS_GEM_VERSION}"
    require 'action_view'
    class ActionView::TemplateHandlers::ERB
      def erb_trim_mode
        '%-'
      end
    end
    

    February 17th, 2010 @ 05:37 PM

  12. cult hero
    cult hero

    This is also a problem in the Rails 3 beta.

    I used this code in my config/application.rb to get around it:

    class ActionView::Template::Handler::ERB
      def erb_trim_mode
        '>'
      end
    end
    

    March 24th, 2010 @ 07:13 PM

  13. Rizwan Reza
    Rizwan Reza
    • Tag changed from 2.3.x, actionview, config, configuration, erb to 2.3.x, actionview, bugmash, config, configuration, erb

    May 16th, 2010 @ 02:41 AM

  14. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.6 to 2.3.7

    May 23rd, 2010 @ 05:54 PM

  15. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.7 to 2.3.8

    May 24th, 2010 @ 09:40 AM

  16. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.8 to 2.3.9

    May 25th, 2010 @ 11:45 PM

  17. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.9 to 2.3.10
    • Importance changed from to Low

    August 30th, 2010 @ 02:28 AM

  18. Santiago Pastorino
    Santiago Pastorino
    • Tag changed from 2.3.x, actionview, bugmash, config, configuration, erb to 23x, actionview, bugmash, config, configuration, erb

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:33 PM

  19. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:33 PM