vendor/rails/actionpack/lib/action_view/renderable_partial.rb in radiant-0.9.1 vs vendor/rails/actionpack/lib/action_view/renderable_partial.rb in radiant-1.0.0.rc1
- old
+ new
@@ -25,11 +25,11 @@
end
def render_partial(view, object = nil, local_assigns = {}, as = nil)
object ||= local_assigns[:object] || local_assigns[variable_name]
- if object.nil? && view.respond_to?(:controller)
+ if object.nil? && !local_assigns_key?(local_assigns) && view.respond_to?(:controller)
ivar = :"@#{variable_name}"
object =
if view.controller.instance_variable_defined?(ivar)
ActiveSupport::Deprecation::DeprecatedObjectProxy.new(
view.controller.instance_variable_get(ivar),
@@ -41,7 +41,13 @@
local_assigns[:object] = local_assigns[variable_name] = object
local_assigns[as] = object if as
render_template(view, local_assigns)
end
+
+ private
+
+ def local_assigns_key?(local_assigns)
+ local_assigns.key?(:object) || local_assigns.key?(variable_name)
+ end
end
end