Files
ubicloud/model/project_quota.rb
Jeremy Evans 679b5b719b Remove usage of class variables
Class variables are a Ruby misfeature that is almost never a good
idea to use.  Replace most usage with class instance variables, and
one case with a constant.

Add freeze methods to classes switching from class variables to
class instance variables, which ensure the class instance variable
is set before the class is frozen.
2024-10-30 10:05:52 -07:00

21 lines
401 B
Ruby

# frozen_string_literal: true
require_relative "../model"
class ProjectQuota < Sequel::Model
# :nocov:
def self.freeze
default_quotas
super
end
# :nocov:
def self.default_quotas
@default_quotas ||= YAML.load_file("config/default_quotas.yml").each_with_object({}) do |item, hash|
hash[item["resource_type"]] = item
end
end
end
ProjectQuota.unrestrict_primary_key