Skip to content

Commit

Permalink
Always treat the object passed to content_tag_for as an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
coop authored and carlosantoniodasilva committed Jan 18, 2012
1 parent 57aaaa6 commit 67681cb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions actionpack/lib/action_view/helpers/record_tag_helper.rb
Expand Up @@ -81,13 +81,9 @@ def div_for(record, *args, &block)
# <li id="person_123" class="person bar">... # <li id="person_123" class="person bar">...
# #
def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options = nil, &block) def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options = nil, &block)
if single_or_multiple_records.respond_to?(:to_ary) Array.wrap(single_or_multiple_records).map do |single_record|
single_or_multiple_records.to_ary.map do |single_record| capture { content_tag_for_single_record(tag_name, single_record, prefix, options, &block) }
capture { content_tag_for_single_record(tag_name, single_record, prefix, options, &block) } end.join("\n").html_safe
end.join("\n").html_safe
else
content_tag_for_single_record(tag_name, single_or_multiple_records, prefix, options, &block)
end
end end


private private
Expand Down

0 comments on commit 67681cb

Please sign in to comment.