diff options
author | Michael Koziarski <michael@koziarski.com> | 2010-10-08 11:12:11 +1300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2010-10-08 11:12:11 +1300 |
commit | 581b2b68368e3330cc725a305d0e2465c2e71e1c (patch) | |
tree | 6e6e6df132e6e9334f29bbf2f738b0bd7531be81 /actionpack/lib | |
parent | c7760809bfc8e19362272b71b23a294d48195d65 (diff) | |
download | rails-581b2b68368e3330cc725a305d0e2465c2e71e1c.tar.gz rails-581b2b68368e3330cc725a305d0e2465c2e71e1c.tar.bz2 rails-581b2b68368e3330cc725a305d0e2465c2e71e1c.zip |
fix rendering a partial with an array as its :object [#5746 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Conflicts:
actionpack/lib/action_view/render/partials.rb
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/render/partials.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index 24d9e9ffb5..4e03d43358 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -235,7 +235,7 @@ module ActionView else @object = partial - if @collection = collection + if @collection = collection_from_object || collection paths = @collection_data = @collection.map { |o| partial_path(o) } @path = paths.uniq.size == 1 ? paths.first : nil else @@ -337,10 +337,14 @@ module ActionView private def collection + if @options.key?(:collection) + @options[:collection] || [] + end + end + + def collection_from_object if @object.respond_to?(:to_ary) @object - elsif @options.key?(:collection) - @options[:collection] || [] end end |