Sha256: a5eb6d7b230f06f7fa173b9a06f6ae590224d16b03de8711f3799d4232df6ba2
Contents?: true
Size: 948 Bytes
Versions: 11
Compression:
Stored size: 948 Bytes
Contents
# frozen_string_literal: true module ThinkingSphinx::ActiveRecord::AssociationProxy def search(query = nil, options = {}) perform_search super(*normalise_search_arguments(query, options)) end def search_for_ids(query = nil, options = {}) perform_search super(*normalise_search_arguments(query, options)) end private def normalise_search_arguments(query, options) query, options = nil, query if query.is_a?(Hash) options[:ignore_scopes] = true [query, options] end def perform_search(searcher) ThinkingSphinx::Search::Merger.new(searcher).merge! nil, :with => association_filter end def association_filter attribute = AttributeFinder.new(proxy_association).attribute {attribute.name.to_sym => proxy_association.owner.id} end end require 'thinking_sphinx/active_record/association_proxy/attribute_finder' require 'thinking_sphinx/active_record/association_proxy/attribute_matcher'
Version data entries
11 entries across 11 versions & 1 rubygems