Method: ActionView::Helpers::TagHelper::TagBuilder#attributes
- Defined in:
- lib/action_view/helpers/tag_helper.rb
#attributes(attributes) ⇒ Object
Transforms a Hash into HTML Attributes, ready to be interpolated into ERB.
<input <%= tag.attributes(type: :text, aria: { label: "Search" }) %> >
# => <input type="text" aria-label="Search">
222 223 224 |
# File 'lib/action_view/helpers/tag_helper.rb', line 222 def attributes(attributes) (attributes.to_h).to_s.strip.html_safe end |