retrospring/app/models/anonymous_block.rb
Karina Kwiatek d9ff4d5765 Refactor Ajax::QuestionController#create into separate UseCases
Co-authored-by: Georg Gadinger <nilsding@nilsding.org>
2022-07-17 10:05:20 +02:00

12 lines
265 B
Ruby

# frozen_string_literal: true
require "digest"
class AnonymousBlock < ApplicationRecord
belongs_to :user
belongs_to :question, optional: true
def self.get_identifier(ip)
Digest::SHA2.new(512).hexdigest(Rails.application.secret_key_base + ip)
end
end