This project is archived and is in readonly mode.
ActionView::TemplateHandlers::ERB.erb_trim_mode= broken
Reported by Jos Backus | April 23rd, 2009 @ 10:27 PM | in 2.3.10
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
}}}
Comments and changes to this ticket
-
CancelProfileIsBroken August 6th, 2009 @ 02:12 PM
- Tag set to bugmash
-
Rizwan Reza August 8th, 2009 @ 02:08 PM
- 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.
-
Dan Pickett August 8th, 2009 @ 05:39 PM
+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
-
Dan Pickett August 8th, 2009 @ 06:00 PM
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
-
Elad Meidar September 27th, 2009 @ 06:27 AM
+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
-
Kieran P September 27th, 2009 @ 07:12 AM
+1 verified I'm with Elad and Dan for finding a better way to set this though.
-
Rizwan Reza January 21st, 2010 @ 07:36 AM
- 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
-
Rizwan Reza January 21st, 2010 @ 07:36 AM
- Milestone changed from 2.x to 2.3.6
-
niklas February 17th, 2010 @ 05:37 PM
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
-
cult hero March 24th, 2010 @ 07:13 PM
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
-
Rizwan Reza May 16th, 2010 @ 02:41 AM
- Tag changed from 2.3.x, actionview, config, configuration, erb to 2.3.x, actionview, bugmash, config, configuration, erb
-
Jeremy Kemper August 30th, 2010 @ 02:28 AM
- Milestone changed from 2.3.9 to 2.3.10
- Importance changed from to Low
-
Santiago Pastorino February 2nd, 2011 @ 04:33 PM
- 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.
-
Santiago Pastorino February 2nd, 2011 @ 04:33 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Referenced by
- 4582 Multiple encoding support for Erubis fixed wrong trim parameter for Erubis and Erb (related to...