Skip to content

Commit

Permalink
API change: content_tag_for outputs prefixed class name
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Oct 8, 2009
1 parent 665c7ad commit 3b6bdfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions actionpack/lib/action_view/helpers/record_tag_helper.rb
Expand Up @@ -15,7 +15,7 @@ module RecordTagHelper
def div_for(record, *args, &block)
content_tag_for(:div, record, *args, &block)
end

# content_tag_for creates an HTML element with id and class parameters
# that relate to the specified Active Record object. For example:
#
Expand All @@ -34,7 +34,7 @@ def div_for(record, *args, &block)
# <% content_tag_for(:tr, @person, :foo) do %> ...
#
# produces:
#
#
# <tr id="foo_person_123" class="person">...
#
# content_tag_for also accepts a hash of options, which will be converted to
Expand All @@ -50,7 +50,7 @@ def div_for(record, *args, &block)
def content_tag_for(tag_name, record, *args, &block)
prefix = args.first.is_a?(Hash) ? nil : args.shift
options = args.extract_options!
options.merge!({ :class => "#{dom_class(record)} #{options[:class]}".strip, :id => dom_id(record, prefix) })
options.merge!({ :class => "#{dom_class(record, prefix)} #{options[:class]}".strip, :id => dom_id(record, prefix) })
content_tag(tag_name, options, &block)
end
end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/template/record_tag_helper_test.rb
Expand Up @@ -27,7 +27,7 @@ def test_content_tag_for
end

def test_content_tag_for_prefix
expected = %(<ul class="post" id="archived_post_45"></ul>)
expected = %(<ul class="archived_post" id="archived_post_45"></ul>)
actual = content_tag_for(:ul, @post, :archived) { }
assert_dom_equal expected, actual
end
Expand Down

0 comments on commit 3b6bdfc

Please sign in to comment.