Permalink
Browse files

Fix problem with render :partial collections, records, and locals. #1…

…1057 [lotswholetime]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8822 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 218417b commit c848c4c6217d825514fe96b37c17ac446a9cd779 Marcel Molina committed Feb 8, 2008
@@ -1,5 +1,7 @@
*SVN*
+* Fix problem with render :partial collections, records, and locals. #11057 [lotswholetime]
+
* Added support for naming concrete classes in sweeper declarations [DHH]
* Remove ERB trim variables from trace template in case ActionView::Base.erb_trim_mode is changed in the application. #10098 [tpope, kampers]
@@ -127,14 +127,14 @@ def render_partial(partial_path, object_assigns = nil, local_assigns = nil) #:no
if partial_path.any?
path = ActionController::RecordIdentifier.partial_path(partial_path.first)
collection = partial_path
- render_partial_collection(path, collection, nil, object_assigns.value)
+ render_partial_collection(path, collection, nil, local_assigns)
else
""
end
else
render_partial(
ActionController::RecordIdentifier.partial_path(partial_path),
- object_assigns, local_assigns)
+ partial_path, local_assigns)
end
end
@@ -34,6 +34,7 @@ def render_with_record_collection
render :partial => @developers
end
end
+ RenderPartialWithRecordIdentificationController.view_paths = [ File.dirname(__FILE__) + "/../fixtures/" ]
def setup
@controller = RenderPartialWithRecordIdentificationController.new
@@ -58,8 +59,10 @@ def test_rendering_partial_with_has_many_association
end
def test_rendering_partial_with_belongs_to_association
+ topic = Reply.find(1).topic
get :render_with_belongs_to_association
assert_template 'topics/_topic'
+ assert_equal topic.title, @response.body
end
def test_render_with_record
@@ -151,6 +151,10 @@ def partial_collection_with_locals
render :partial => "customer_greeting", :collection => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" }
end
+ def partial_collection_shorthand_with_locals
+ render :partial => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" }
+ end
+
def empty_partial_collection
render :partial => "customer", :collection => []
end
@@ -708,6 +712,11 @@ def test_partial_collection_with_locals
assert_equal "Bonjour: davidBonjour: mary", @response.body
end
+ def test_partial_collection_shorthand_with_locals
+ get :partial_collection_shorthand_with_locals
+ assert_equal "Bonjour: davidBonjour: mary", @response.body
+ end
+
def test_empty_partial_collection
get :empty_partial_collection
assert_equal " ", @response.body

0 comments on commit c848c4c

Please sign in to comment.