discourse/app/models/developer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
648 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Developer < ActiveRecord::Base
belongs_to :user
after_save :rebuild_cache
after_destroy :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
2016-08-15 02:44:24 -05:00
# == Schema Information
#
# Table name: developers
#
# id :integer not null, primary key
# user_id :integer not null
#
2019-11-29 09:49:08 -06:00
# Indexes
#
# index_developers_on_user_id (user_id) UNIQUE
#