1
1

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.

rails カラムの値 一斉変更

Posted at

1日1回回答できるクイズの残回答数を24時にリセットするバッチにて用いた

app/models/quiz.rb
class Quiz < ActiveRecord::Base
  def self.reset_quota
    QuizUserStatus.all.update_all(quota: 1)
  end
end

なお、条件次第で残1以上になるため今回はこのような実装にした

以上。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?