Permalink
Browse files

refactor content_tag_for helper

- do not use merge! just for 2 values
- there is no need to check block arity
  • Loading branch information...
1 parent 0f848dd commit 10f90bd24137cf9338b9aa72555bf67c69e4737e @lest lest committed Apr 26, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 actionpack/lib/action_view/helpers/record_tag_helper.rb
@@ -94,10 +94,10 @@ def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options
# for each record.
def content_tag_for_single_record(tag_name, record, prefix, options, &block)
options = options ? options.dup : {}
- options.merge!(:class => "#{dom_class(record, prefix)} #{options[:class]}".rstrip, :id => dom_id(record, prefix))
+ options[:class] = "#{dom_class(record, prefix)} #{options[:class]}".rstrip
+ options[:id] = dom_id(record, prefix)
- content = block.arity == 0 ? capture(&block) : capture(record, &block)
- content_tag(tag_name, content, options)
+ content_tag(tag_name, capture(record, &block), options)
end
end
end

0 comments on commit 10f90bd

Please sign in to comment.