Skip to content
This repository
Browse code

API change: content_tag_for outputs prefixed class name

  • Loading branch information...
commit 3b6bdfc1050a83c6339421257d60a6163bf3c687 1 parent 665c7ad
Joshua Peek authored October 08, 2009
6  actionpack/lib/action_view/helpers/record_tag_helper.rb
@@ -15,7 +15,7 @@ module RecordTagHelper
15 15
       def div_for(record, *args, &block)
16 16
         content_tag_for(:div, record, *args, &block)
17 17
       end
18  
-  
  18
+
19 19
       # content_tag_for creates an HTML element with id and class parameters
20 20
       # that relate to the specified Active Record object. For example:
21 21
       #
@@ -34,7 +34,7 @@ def div_for(record, *args, &block)
34 34
       #    <% content_tag_for(:tr, @person, :foo) do %> ...
35 35
       #
36 36
       # produces:
37  
-      #    
  37
+      #
38 38
       #    <tr id="foo_person_123" class="person">...
39 39
       #
40 40
       # content_tag_for also accepts a hash of options, which will be converted to
@@ -50,7 +50,7 @@ def div_for(record, *args, &block)
50 50
       def content_tag_for(tag_name, record, *args, &block)
51 51
         prefix  = args.first.is_a?(Hash) ? nil : args.shift
52 52
         options = args.extract_options!
53  
-        options.merge!({ :class => "#{dom_class(record)} #{options[:class]}".strip, :id => dom_id(record, prefix) })
  53
+        options.merge!({ :class => "#{dom_class(record, prefix)} #{options[:class]}".strip, :id => dom_id(record, prefix) })
54 54
         content_tag(tag_name, options, &block)
55 55
       end
56 56
     end
2  actionpack/test/template/record_tag_helper_test.rb
@@ -27,7 +27,7 @@ def test_content_tag_for
27 27
   end
28 28
 
29 29
   def test_content_tag_for_prefix
30  
-    expected = %(<ul class="post" id="archived_post_45"></ul>)
  30
+    expected = %(<ul class="archived_post" id="archived_post_45"></ul>)
31 31
     actual = content_tag_for(:ul, @post, :archived) { }
32 32
     assert_dom_equal expected, actual
33 33
   end

0 notes on commit 3b6bdfc

Please sign in to comment.
Something went wrong with that request. Please try again.