2022-06-14 15:17:02 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-01-23 10:25:56 -08:00
|
|
|
require "digest"
|
|
|
|
|
2022-06-14 08:09:10 -07:00
|
|
|
class AnonymousBlock < ApplicationRecord
|
2022-08-12 02:53:42 -07:00
|
|
|
belongs_to :user, optional: true
|
2022-06-14 08:09:10 -07:00
|
|
|
belongs_to :question, optional: true
|
2022-12-26 17:26:06 -08:00
|
|
|
belongs_to :target_user, class_name: "User", optional: true
|
2022-06-14 13:51:31 -07:00
|
|
|
|
|
|
|
def self.get_identifier(ip)
|
|
|
|
Digest::SHA2.new(512).hexdigest(Rails.application.secret_key_base + ip)
|
|
|
|
end
|
2022-06-14 08:09:10 -07:00
|
|
|
end
|