Sha256: fd3dc28c6b99dad5fe63c03e4740fab84757488acb94ab94d6e14e2a11968096
Contents?: true
Size: 743 Bytes
Versions: 13
Compression:
Stored size: 743 Bytes
Contents
module Perus::Server class Config < Sequel::Model plugin :validation_helpers one_to_many :systems one_to_many :config_metrics, order: 'name asc' def metric_hashes config_metrics.collect(&:config_hash) end def largest_order if config_metrics.empty? 0 else config_metrics.last.order end end def can_delete? systems_dataset.empty? end def validate super validates_presence :name validates_unique :name end def after_destroy super config_metrics.each(&:destroy) end end end
Version data entries
13 entries across 13 versions & 1 rubygems