From 67681cb1031f41a610e94b9339f0a1b6f2a99a39 Mon Sep 17 00:00:00 2001 From: Tim Cooper Date: Fri, 6 Jan 2012 14:32:25 +1000 Subject: Always treat the object passed to content_tag_for as an array. --- actionpack/lib/action_view/helpers/record_tag_helper.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_view') 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 #
  • ... # 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 -- cgit v1.2.3