docbrown/app/models/user_counter.rb
rhymes a1835ae5b9
User counters using PostgreSQL JSON (#5373) [deploy]
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-02-03 10:35:08 -05:00

11 lines
367 B
Ruby

class UserCounter < ApplicationRecord
belongs_to :user
serialize :data, HashSerializer
store_accessor :data, :comments_these_7_days, :comments_prior_7_days
validates :user, presence: true, uniqueness: true
validates :comments_these_7_days, numericality: { only_integer: true }
validates :comments_prior_7_days, numericality: { only_integer: true }
end