1日1回回答できるクイズの残回答数を24時にリセットするバッチにて用いた
app/models/quiz.rb
class Quiz < ActiveRecord::Base
def self.reset_quota
QuizUserStatus.all.update_all(quota: 1)
end
end
なお、条件次第で残1以上になるため今回はこのような実装にした
以上。
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
1日1回回答できるクイズの残回答数を24時にリセットするバッチにて用いた
class Quiz < ActiveRecord::Base
def self.reset_quota
QuizUserStatus.all.update_all(quota: 1)
end
end
なお、条件次第で残1以上になるため今回はこのような実装にした
以上。
Register as a new user and use Qiita more conveniently
Go to list of users who liked