aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_view/base.rb13
-rw-r--r--actionpack/lib/action_view/partial_template.rb2
-rw-r--r--actionpack/lib/action_view/partials.rb2
-rw-r--r--actionpack/lib/action_view/template.rb12
4 files changed, 16 insertions, 13 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 4ed20fec89..bfd1a0ee0d 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -244,16 +244,7 @@ If you are rendering a subtemplate, you must now use controller-like partial syn
template = Template.new(self, template_path, use_full_path, local_assigns)
- begin
- render_template(template)
- rescue Exception => e
- if TemplateError === e
- e.sub_template_of(template.filename)
- raise e
- else
- raise TemplateError.new(template, @assigns, e)
- end
- end
+ render_template(template)
end
# Renders the template present at <tt>template_path</tt> (relative to the view_paths array).
@@ -290,7 +281,7 @@ If you are rendering a subtemplate, you must now use controller-like partial syn
end
def render_template(template) #:nodoc:
- template.render
+ template.render_template
end
# Returns true is the file may be rendered implicitly.
diff --git a/actionpack/lib/action_view/partial_template.rb b/actionpack/lib/action_view/partial_template.rb
index 7d9c59a41c..ffcf258afe 100644
--- a/actionpack/lib/action_view/partial_template.rb
+++ b/actionpack/lib/action_view/partial_template.rb
@@ -24,7 +24,7 @@ module ActionView #:nodoc:
def render_member(object)
@locals[@counter_name] += 1
@locals[:object] = @locals[@variable_name] = object
- returning render do
+ returning render_template do
@locals.delete(@variable_name)
@locals.delete(:object)
end
diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb
index 9afaa16918..b537eb8bf8 100644
--- a/actionpack/lib/action_view/partials.rb
+++ b/actionpack/lib/action_view/partials.rb
@@ -107,7 +107,7 @@ module ActionView
case partial_path
when String, Symbol, NilClass
# Render the template
- ActionView::PartialTemplate.new(self, partial_path, object_assigns, local_assigns).render
+ ActionView::PartialTemplate.new(self, partial_path, object_assigns, local_assigns).render_template
when ActionView::Helpers::FormBuilder
builder_partial_path = partial_path.class.to_s.demodulize.underscore.sub(/_builder$/, '')
render_partial(builder_partial_path, object_assigns, (local_assigns || {}).merge(builder_partial_path.to_sym => partial_path))
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index bc3d8d5e52..2cda3d94b5 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -17,6 +17,18 @@ module ActionView #:nodoc:
@locals = locals || {}
@handler = self.class.handler_class_for_extension(@extension).new(@view)
end
+
+ def render_template
+ render
+ rescue Exception => e
+ raise e unless filename
+ if TemplateError === e
+ e.sub_template_of(filename)
+ raise e
+ else
+ raise TemplateError.new(self, @view.assigns, e)
+ end
+ end
def render
prepare!