Sha256: 9038c39314570ec1037533f4e89b3177ae2fd711a42e3b7065c2310bc3513c2a
Contents?: true
Size: 1005 Bytes
Versions: 24
Compression:
Stored size: 1005 Bytes
Contents
module Katello module Validators # ensures that the Default Organization View content view can only be used with the Library environment class ContentViewEnvironmentCoherentDefaultValidator < ActiveModel::Validator def validate(record) #support lifecycle_environment_id for foreman models environment_id = record.respond_to?(:lifecycle_environment_id) ? record.lifecycle_environment_id : record.environment_id if record.content_view_id view = ContentView.where(:id => record.content_view_id).first if environment_id env = KTEnvironment.where(:id => environment_id).first return if view.blank? || env.blank? if view.default? && !env.library? record.errors[:base] << _("Lifecycle environment '%{env}' cannot be used with content view '%{view}'") % {:view => view.name, :env => env.name} end end end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems