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

Version Path
katello-4.0.3 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.2.0.1.rc3 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.18.5 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.2.0.1.rc2 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.2.0.rc2 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.3 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.2.0.rc1 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.0.2.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.2.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.0.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.18.4 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.0 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.0.1.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.18.3.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.0.rc2.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.1.0.rc2.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-4.0.1.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.18.3 app/lib/katello/validators/content_view_environment_validator.rb