diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-10-30 21:11:46 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-10-30 21:11:46 +0100 |
commit | 7857e42103ca1ab9e8d7f363527ddb2af3e8bd65 (patch) | |
tree | 32b958208814e5c7c8938df3b15b487c4f8cecc3 /actionpack | |
parent | 47b4fa4a621ee48ab17545b1e9fb38efef53b28e (diff) | |
parent | ec38c84ce1ff7f0888becc15e3f58337ca807e25 (diff) | |
download | rails-7857e42103ca1ab9e8d7f363527ddb2af3e8bd65.tar.gz rails-7857e42103ca1ab9e8d7f363527ddb2af3e8bd65.tar.bz2 rails-7857e42103ca1ab9e8d7f363527ddb2af3e8bd65.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/partials.rb | 2 | ||||
-rw-r--r-- | actionpack/test/fixtures/test/_customer.erb | 2 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb index 373bb92dc4..8841099900 100644 --- a/actionpack/lib/action_view/partials.rb +++ b/actionpack/lib/action_view/partials.rb @@ -181,7 +181,7 @@ module ActionView ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path) template = _pick_partial_template(_partial_path) local_assigns[template.counter_name] = index - result = template.render_partial(self, object, local_assigns, as) + result = template.render_partial(self, object, local_assigns.dup, as) index += 1 result end.join(spacer) diff --git a/actionpack/test/fixtures/test/_customer.erb b/actionpack/test/fixtures/test/_customer.erb index 872d8c44e6..d8220afeda 100644 --- a/actionpack/test/fixtures/test/_customer.erb +++ b/actionpack/test/fixtures/test/_customer.erb @@ -1 +1 @@ -Hello: <%= customer.name %>
\ No newline at end of file +Hello: <%= customer.name rescue "Anonymous" %>
\ No newline at end of file diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index da8c782880..476e651757 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -115,6 +115,10 @@ class ViewRenderTest < Test::Unit::TestCase assert_nil @view.render(:partial => "test/customer", :collection => nil) end + def test_render_partial_with_nil_values_in_collection + assert_equal "Hello: davidHello: Anonymous", @view.render(:partial => "test/customer", :collection => [ Customer.new("david"), nil ]) + end + def test_render_partial_with_empty_array_should_return_nil assert_nil @view.render(:partial => []) end |