From e3c02d8c66ae3df7a58ba7d76dfc464f26dcff67 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 9 Sep 2005 07:27:44 +0000 Subject: Fixed that render :partial would fail when :object was a Hash (due to backwards compatibility issues) #2148 [Sam Stephenson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2160 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/base.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/base.rb') 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 -- cgit v1.2.3