Skip to content

Commit c05f24c

Browse files
committed
Speed up content_tag_for by simplifying needed logic
1 parent 3805d01 commit c05f24c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

actionpack/lib/action_view/helpers/record_tag_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ def div_for(record, *args, &block)
5252
#
5353
# <li id="person_123" class="person bar">...
5454
#
55-
def content_tag_for(tag_name, record, *args, &block)
56-
prefix = args.first.is_a?(Hash) ? nil : args.shift
57-
options = args.extract_options!
55+
def content_tag_for(tag_name, record, prefix = nil, options = nil, &block)
56+
options, prefix = prefix, nil if prefix.is_a?(Hash)
57+
options ||= {}
5858
options.merge!({ :class => "#{dom_class(record, prefix)} #{options[:class]}".strip, :id => dom_id(record, prefix) })
5959
content_tag(tag_name, options, &block)
6060
end

0 commit comments

Comments
 (0)