目次
- 本体を持たない任意のタグを生成(tag)
<base>
本体を持たない任意のタグを生成(tag)
適応バージョン
- 1.0.0
- 1.1.0
- 1.1.1
- 1.1.6
- 1.2.0
- 1.2.6
- 2.0.0
- 2.0.1
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.2
- 2.3.8
- 3.0.0
- 3.0.5
- 3.0.7
- 3.0.9
- 3.1.0
- 3.2.3
- 3.2.8
- 3.2.13
- 4.0.0
説明
本体を持たない任意のタグを生成
使い方
tag(タグ名 [, タグの属性])
例
brタグを生成
tag("br")
inputタグを生成
tag("input", { :type => 'text', :disabled => true })
imgタグを生成
tag("img", { :src => "open & shut.png" })
ソースコード
ソースコードを見る
# File /usr/local/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_view/helpers/tag_helper.rb, line 64
def tag(name, options = nil, open = false, escape = true)
"<#{name}#{tag_options(options, escape) if options}#{open ? ">" : " />"}".html_safe
end