Sha256: 070a7b2d1b70d2a316eb38da6c1f504e9071348580d8abe8e8fd86ba5f4455a2
Contents?: true
Size: 809 Bytes
Versions: 142
Compression:
Stored size: 809 Bytes
Contents
module Katello module Validators class ContentViewEnvironmentValidator < 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 && environment_id view = ContentView.where(:id => record.content_view_id).first env = KTEnvironment.where(:id => environment_id).first unless view.blank? || env.blank? || view.in_environment?(env) record.errors[:base] << _("Content view '%{view}' is not in environment '%{env}'") % {:view => view.name, :env => env.name} end end end end end end
Version data entries
142 entries across 142 versions & 1 rubygems