diff options
author | Hendy Tanata <htanata@gmail.com> | 2014-03-05 11:38:39 -0800 |
---|---|---|
committer | Hendy Tanata <htanata@gmail.com> | 2014-03-05 11:54:18 -0800 |
commit | 589d1ed722a3add255adc5636eab7dcc262dd0ca (patch) | |
tree | f792382453b65d67c0a8712e4c44996da7c81de7 /actionview | |
parent | cee7a06746ef194c922f96209a876648b8be0d59 (diff) | |
download | rails-589d1ed722a3add255adc5636eab7dcc262dd0ca.tar.gz rails-589d1ed722a3add255adc5636eab7dcc262dd0ca.tar.bz2 rails-589d1ed722a3add255adc5636eab7dcc262dd0ca.zip |
Update doc for TagHelper.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/helpers/tag_helper.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index 3528381781..a9f3b0ffbc 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -42,7 +42,8 @@ module ActionView # For example, a key +user_id+ would render as <tt>data-user-id</tt> and # thus accessed as <tt>dataset.userId</tt>. # - # Values are encoded to JSON, with the exception of strings and symbols. + # Values are encoded to JSON, with the exception of strings, symbols and + # BigDecimals. # This may come in handy when using jQuery's HTML5-aware <tt>.data()</tt> # from 1.4.3. # @@ -56,6 +57,9 @@ module ActionView # tag("input", type: 'text', disabled: true) # # => <input type="text" disabled="disabled" /> # + # tag("input", type: 'text', class: ["strong", "highlight"]) + # # => <input class="strong highlight" type="text" /> + # # tag("img", src: "open & shut.png") # # => <img src="open & shut.png" /> # @@ -75,7 +79,7 @@ module ActionView # Set escape to false to disable attribute value escaping. # # ==== Options - # The +options+ hash is used with attributes with no value like (<tt>disabled</tt> and + # The +options+ hash can be used with attributes with no value like (<tt>disabled</tt> and # <tt>readonly</tt>), which you can give a value of true in the +options+ hash. You can use # symbols or strings for the attribute names. # @@ -84,6 +88,8 @@ module ActionView # # => <p>Hello world!</p> # content_tag(:div, content_tag(:p, "Hello world!"), class: "strong") # # => <div class="strong"><p>Hello world!</p></div> + # content_tag(:div, "Hello world!", class: ["strong", "highlight"]) + # # => <div class="strong highlight">Hello world!</div> # content_tag("select", options, multiple: true) # # => <select multiple="multiple">...options...</select> # |