19
11

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 5 years have passed since last update.

update_columnとupdate_columnsの違い

Posted at
  • 特定の行の特定のカラムを更新する。
  • 直接SQLが発行されバリデーションやコールバックは走らない。
  • 更新日時だけを更新したい場合や、コールバックを走らせたくない場合に便利。

単数の場合

article.update_column(:title, 'title')

複数の場合

article.update_columns(hoge: "hoge", fuga: "fuga")

参考

19
11
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
19
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?