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

Version Path
katello-3.5.0.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.5.0 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.5.0.rc2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.5.0.rc1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.5 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.4 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.0.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.0.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.0 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.0.rc2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.4.0.rc1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.1.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.0.1 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.0 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.0.rc2 app/lib/katello/validators/content_view_environment_validator.rb
katello-3.3.0.rc1.1 app/lib/katello/validators/content_view_environment_validator.rb