1
0

More than 3 years have passed since last update.

【Rails】各タグごとのクラスやその他メソッドの記述の仕方

Last updated at Posted at 2020-04-18

【Rails】各タグごとのクラスやその他メソッドの記述の仕方

この記事のゴール

・Railsのタグにおけるクラスの定義の仕方をインプットする

Link_toタグ

html.erb
<%= link_to 'リンクに表示する文字列', @モデル名など, class: "btn" %>

text_fieldタグ

html.erb
 <%= f.text_field :title, class: "hogehoge" %>

text_areaタグ

html.erb
<%= f.text_area :content, class: "hogehoge",placeholder: "内容を投稿する" %>

link_to(deleteメソッド)タグ

html.erb
<%= link_to(content_tag(:i, 'Destroy', class: 'far fa-edit'), post_path(post), :method => :delete) %>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0