LoginSignup
3
1

カラム名.present?の省略方法

Last updated at Posted at 2024-06-25

下の記事の内容は正しくありません。
カラム名.present?の省略方法がActiveRecordで元から用意されていたので、自分用に残しておきます。

user = User.first
user.name? # user.name.present? と同意
# => true / false

rails cの補完機能を使っていると見つけました。
このような元から用意されてある動的なメソッドは、まだまだたくさんあるみたいなので、もっと勉強していこうと思います!

3
1
2

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
3
1