Sha256: c424ecffe0080b456574c3ca4dfbf198a88b65941e588a040f354146fcce9867
Contents?: true
Size: 676 Bytes
Versions: 250
Compression:
Stored size: 676 Bytes
Contents
module Katello module Validators class PathDescendentsValidator < ActiveModel::Validator def validate(record) #need to ensure that #environment is not duplicated in its path # We do not want circular dependencies return if record.prior.nil? record.errors[:prior] << _(" environment cannot be set to an environment already on its path") if duplicate? record.prior end def duplicate?(record) s = record.successor ret = [record.id] until s.nil? return true if ret.include? s.id ret << s.id s = s.successor end false end end end end
Version data entries
250 entries across 250 versions & 1 rubygems