2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/app/models/developer.rb
Jarek Radosz 71834c898f
DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00

36 lines
648 B
Ruby

# frozen_string_literal: true
class Developer < ActiveRecord::Base
belongs_to :user
after_destroy :rebuild_cache
after_save :rebuild_cache
def self.id_cache
@id_cache ||= DistributedCache.new("developer_ids")
end
def self.user_ids
id_cache.defer_get_set("ids") { Set.new(Developer.pluck(:user_id)) }
end
def self.rebuild_cache
id_cache.clear
end
def rebuild_cache
Developer.rebuild_cache
end
end
# == Schema Information
#
# Table name: developers
#
# id :integer not null, primary key
# user_id :integer not null
#
# Indexes
#
# index_developers_on_user_id (user_id) UNIQUE
#