0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

#Rails ActiveRecord aks instance to column presence or nil ? merthod / Model#name?

Last updated at Posted at 2020-02-20
user = User.first

# When presence
user.update!(name: "xxx")
# user.name?
=> true

# When blank
user.update!(name: "")
user.name?
# => true

# When nil
User.first.name?
user.name?
# => false


# Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2996








<!-- Update From Qiita API -->

# チャットメンバー募集


何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ





# Twitter


https://twitter.com/YumaInaura


<!-- Update From Qiita API -->

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?