aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/render/partials.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/render/partials.rb')
-rw-r--r--actionpack/lib/action_view/render/partials.rb32
1 files changed, 20 insertions, 12 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb
index 43f8a1edf8..f2429e8cef 100644
--- a/actionpack/lib/action_view/render/partials.rb
+++ b/actionpack/lib/action_view/render/partials.rb
@@ -171,11 +171,21 @@ module ActionView
# <% end %>
module Partials
extend ActiveSupport::Memoizable
+ extend ActiveSupport::DependencyModule
+
+ included do
+ attr_accessor :_partial
+ end
+
+ def _render_partial_from_controller(*args)
+ @assigns_added = false
+ _render_partial(*args)
+ end
def _render_partial(options = {}) #:nodoc:
options[:locals] ||= {}
- case path = partial = options[:partial]
+ case path = partial = options[:partial]
when *_array_like_objects
return _render_partial_collection(partial, options)
else
@@ -222,16 +232,7 @@ module ActionView
ensure
@_proc_for_layout = nil
end
-
- def _render_partial_with_layout(layout, options)
- if layout
- prefix = controller && !layout.include?("/") ? controller.controller_path : nil
- layout = find_by_parts(layout, {:formats => formats}, prefix, true)
- end
- content = _render_partial(options)
- return _render_content_with_layout(content, layout, options[:locals])
- end
-
+
def _deprecated_ivar_assign(template)
if respond_to?(:controller)
ivar = :"@#{template.variable_name}"
@@ -287,13 +288,17 @@ module ActionView
locals = (options[:locals] ||= {})
object ||= locals[:object] || locals[template.variable_name]
- _set_locals(object, locals, template, options)
+ _set_locals(object, locals, template, options)
+
+ self._partial = template
+
_render_template(template, locals)
end
end
def _set_locals(object, locals, template, options)
object ||= _deprecated_ivar_assign(template)
+
locals[:object] = locals[template.variable_name] = object
locals[options[:as]] = object if options[:as]
end
@@ -316,6 +321,9 @@ module ActionView
locals[template.counter_name] = index
index += 1
+
+ self._partial = template
+
_render_template(template, locals)
end.join(spacer)
end