Sha256: 784c194887d5feccfe60853fba4fcf30a9acf22cc2264abc64030d7883e5c8ee
Contents?: true
Size: 752 Bytes
Versions: 50
Compression:
Stored size: 752 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.find(record.content_view_id) env = KTEnvironment.find(environment_id) unless 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
50 entries across 50 versions & 1 rubygems