aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template_handlers/erb.rb
diff options
context:
space:
mode:
authorSven Fuchs <svenfuchs@artweb-design.de>2008-07-16 03:41:11 +0200
committerSven Fuchs <svenfuchs@artweb-design.de>2008-07-16 03:41:11 +0200
commit931f366ffcacc0444fcca2fb2e2b44644db9642f (patch)
tree4c056de1273d23e2b8494cfe452caaeb98ade820 /actionpack/lib/action_view/template_handlers/erb.rb
parent8691e255402b27eae594530001227fc05416a00c (diff)
parentfbef982e4b906b879240a35a1ecff447007da6b2 (diff)
downloadrails-931f366ffcacc0444fcca2fb2e2b44644db9642f.tar.gz
rails-931f366ffcacc0444fcca2fb2e2b44644db9642f.tar.bz2
rails-931f366ffcacc0444fcca2fb2e2b44644db9642f.zip
merge forward to current rails/master
Diffstat (limited to 'actionpack/lib/action_view/template_handlers/erb.rb')
-rw-r--r--actionpack/lib/action_view/template_handlers/erb.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/template_handlers/erb.rb b/actionpack/lib/action_view/template_handlers/erb.rb
index ad4ccc7c42..2f2febaa52 100644
--- a/actionpack/lib/action_view/template_handlers/erb.rb
+++ b/actionpack/lib/action_view/template_handlers/erb.rb
@@ -42,12 +42,14 @@ module ActionView
class ERB < TemplateHandler
include Compilable
- def compile(template)
- ::ERB.new(template.source, nil, @view.erb_trim_mode, '@output_buffer').src
- end
+ # Specify trim mode for the ERB compiler. Defaults to '-'.
+ # See ERb documentation for suitable values.
+ cattr_accessor :erb_trim_mode
+ self.erb_trim_mode = '-'
- def cache_fragment(block, name = {}, options = nil) #:nodoc:
- @view.fragment_for(block, name, options) { @view.response.template.output_buffer ||= '' }
+ def compile(template)
+ src = ::ERB.new(template.source, nil, erb_trim_mode, '@output_buffer').src
+ "__in_erb_template=true;#{src}"
end
end
end