LoginSignup
1
0

More than 5 years have passed since last update.

first_nameとfirstnameだとどちらがいいのか(Ruby)

Last updated at Posted at 2018-07-13
  • DBのUserテーブルにカラムを作るにあたり、どちらがいいのかを調べた結果をまとめておきます。
  • ほぼこちらのページをまとめた感じです。

結論

  • Rubyならfirst_nameの方がいいよ!

根拠

その1: Ruby-Style-Guideで使われてる。

その2: titleizeメソッドを使った時にそれっぽくなる。

'first_name'.titleize
# => First Name

'firstname'.titleize
# => Firstname
  • 「そもそもtitleizeメソッドなんて使わないよ」とか言われるとそれまでだけど・・・。
  • 意識として、入力欄のラベルにtitleizeを使った時に、「どっちがすっきりとしてみえるか」が選ぶヒントになるかもしれない。

まとめ

  • first_nameを使った方がいいよ!!
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