diff options
author | Tim Cooper <coop@latrobest.com> | 2012-01-06 14:32:25 +1000 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-18 00:43:45 -0200 |
commit | 67681cb1031f41a610e94b9339f0a1b6f2a99a39 (patch) | |
tree | 88e6316bb7615725d1ee56a7bf8eaa7556818cd7 | |
parent | 57aaaa61977e82b9de2c43c26b00e636030685c4 (diff) | |
download | rails-67681cb1031f41a610e94b9339f0a1b6f2a99a39.tar.gz rails-67681cb1031f41a610e94b9339f0a1b6f2a99a39.tar.bz2 rails-67681cb1031f41a610e94b9339f0a1b6f2a99a39.zip |
Always treat the object passed to content_tag_for as an array.
-rw-r--r-- | actionpack/lib/action_view/helpers/record_tag_helper.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb index b351302d01..980fa8130b 100644 --- a/actionpack/lib/action_view/helpers/record_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb @@ -81,13 +81,9 @@ module ActionView # <li id="person_123" class="person bar">... # def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options = nil, &block) - if single_or_multiple_records.respond_to?(:to_ary) - single_or_multiple_records.to_ary.map do |single_record| - capture { content_tag_for_single_record(tag_name, single_record, prefix, options, &block) } - end.join("\n").html_safe - else - content_tag_for_single_record(tag_name, single_or_multiple_records, prefix, options, &block) - end + Array.wrap(single_or_multiple_records).map do |single_record| + capture { content_tag_for_single_record(tag_name, single_record, prefix, options, &block) } + end.join("\n").html_safe end private |