aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/base.rb5
-rw-r--r--actionpack/lib/action_view/partials.rb2
2 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index fbc9a66a05..cbaeedc0fe 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -137,6 +137,9 @@ module ActionView #:nodoc:
@@compiled_templates = CompiledTemplates.new
include @@compiled_templates
+ class ObjectWrapper < Struct.new(:value) #:nodoc:
+ end
+
def self.load_helpers(helper_dir)#:nodoc:
Dir.foreach(helper_dir) do |helper_file|
next unless helper_file =~ /_helper.rb$/
@@ -200,7 +203,7 @@ module ActionView #:nodoc:
elsif options[:partial] && options[:collection]
render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals])
elsif options[:partial]
- render_partial(options[:partial], options[:object], options[:locals])
+ render_partial(options[:partial], ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals])
elsif options[:inline]
render_template(options[:type] || :rhtml, options[:inline], nil, options[:locals] || {})
end
diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb
index e1dcd4ee9d..5a129f12ab 100644
--- a/actionpack/lib/action_view/partials.rb
+++ b/actionpack/lib/action_view/partials.rb
@@ -52,7 +52,7 @@ module ActionView
local_assigns = extract_local_assigns(local_assigns, deprecated_local_assigns)
local_assigns = local_assigns ? local_assigns.clone : {}
add_counter_to_local_assigns!(partial_name, local_assigns)
- local_assigns[partial_name.intern] ||= object
+ local_assigns[partial_name.intern] ||= object.is_a?(ActionView::Base::ObjectWrapper) ? object.value : object
render("#{path}/_#{partial_name}", local_assigns)
end