Sha256: 3f863fc5f9370f9e7f62ab14700fa1aadf4d6e7abe221d15103a16ba8cb28748

Contents?: true

Size: 765 Bytes

Versions: 4

Compression:

Stored size: 765 Bytes

Contents

module Katello
  module Concerns
    module SearchByRepositoryName
      extend ActiveSupport::Concern
      include ScopedSearchExtensions

      included do
        scoped_search :relation => :repositories, :on => :name, :rename => :repository, :complete_value => true, :ext_method => :search_by_repo_name, :only_explicit => true
      end

      module ClassMethods
        def search_by_repo_name(_key, operator, value)
          conditions = sanitize_sql_for_conditions(["#{Katello::RootRepository.table_name}.name #{operator} ?", value_to_sql(operator, value)])
          query = self.joins(:repositories => :root).where(conditions).select('id')
          {:conditions => "#{self.table_name}.id IN (#{query.to_sql})"}
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
katello-3.9.1 app/models/katello/concerns/search_by_repository_name.rb
katello-3.9.0 app/models/katello/concerns/search_by_repository_name.rb
katello-3.9.0.rc2 app/models/katello/concerns/search_by_repository_name.rb
katello-3.9.0.rc1 app/models/katello/concerns/search_by_repository_name.rb