Sha256: fb2f92fc4e8b19f91f58f6d083c3a6bdfe11f5ec93df03d197454253bc7d05ce
Contents?: true
Size: 671 Bytes
Versions: 3
Compression:
Stored size: 671 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 validate super validates_presence :name validates_unique :name end def after_destroy super config_metrics.each(&:destroy) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
perus-0.1.2 | lib/perus/server/models/config.rb |
perus-0.1.1 | lib/perus/server/models/config.rb |
perus-0.1.0 | lib/perus/server/models/config.rb |