public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Ensure :partial => @collection and :collection => @collection behaves same. 
[#884 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
ryanb (author)
Fri Aug 22 08:04:27 -0700 2008
lifo (committer)
Fri Aug 22 10:15:53 -0700 2008
commit  9a5ffaa01e5a13d9ec2209a1a937d46fc12615a1
tree    79c0e40f315ce708e0ff75b4455557cfb0ce44ee
parent  4e4277b9e0a77c62dd1e253156bcde9e4a1a16b2
...
156
157
158
159
 
160
161
162
...
156
157
158
 
159
160
161
162
0
@@ -156,7 +156,7 @@ module ActionView
0
           local_assigns.merge!(builder_partial_path.to_sym => partial_path)
0
           render_partial(:partial => builder_partial_path, :object => options[:object], :locals => local_assigns)
0
         when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope
0
-          partial_path.any? ? render_partial(:collection => partial_path, :locals => local_assigns) : ""
0
+          render_partial_collection(options.except(:partial).merge(:collection => partial_path))
0
         else
0
           object = partial_path
0
           render_partial(
...
39
40
41
 
 
 
 
 
42
43
44
...
81
82
83
 
 
 
 
 
84
85
86
...
39
40
41
42
43
44
45
46
47
48
49
...
86
87
88
89
90
91
92
93
94
95
96
0
@@ -39,6 +39,11 @@ class RenderPartialWithRecordIdentificationController < ActionController::Base
0
     @developers = Developer.find(:all)
0
     render :partial => @developers
0
   end
0
+
0
+  def render_with_record_collection_and_spacer_template
0
+    @developer = Developer.find(1)
0
+    render :partial => @developer.projects, :spacer_template => 'test/partial_only'
0
+  end
0
 end
0
 
0
 class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
0
@@ -81,6 +86,11 @@ class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
0
     assert_equal 'DavidJamisfixture_3fixture_4fixture_5fixture_6fixture_7fixture_8fixture_9fixture_10Jamis', @response.body
0
   end
0
 
0
+  def test_render_with_record_collection_and_spacer_template
0
+    get :render_with_record_collection_and_spacer_template
0
+    assert_equal 'Active Recordonly partialActive Controller', @response.body
0
+  end
0
+
0
   def test_rendering_partial_with_has_one_association
0
     mascot = Company.find(1).mascot
0
     get :render_with_has_one_association
...
95
96
97
 
 
 
 
98
99
100
...
95
96
97
98
99
100
101
102
103
104
0
@@ -95,6 +95,10 @@ class ViewRenderTest < Test::Unit::TestCase
0
     assert_nil @view.render(:partial => "test/customer", :collection => nil)
0
   end
0
 
0
+  def test_render_partial_with_empty_array_should_return_nil
0
+    assert_nil @view.render(:partial => [])
0
+  end
0
+
0
   # TODO: The reason for this test is unclear, improve documentation
0
   def test_render_partial_and_fallback_to_layout
0
     assert_equal "Before (Josh)\n\nAfter", @view.render(:partial => "test/layout_for_partial", :locals => { :name => "Josh" })

Comments