Sha256: 7a14933e592f0a7f85011e4af28e86b693acf3bcdd06eae0c0d877c9e109a6e8
Contents?: true
Size: 930 Bytes
Versions: 152
Compression:
Stored size: 930 Bytes
Contents
module Katello module Concerns module SearchByRepositoryName extend ActiveSupport::Concern include ScopedSearchExtensions included do has_many :root_repositories, through: :repositories, :source => :root, class_name: "Katello::RootRepository" scoped_search :relation => :root_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
152 entries across 152 versions & 1 rubygems