Sha256: 72b21d34f28554531ad6a02b3c00b01ae10737fc279948197c6ecbee2faeaa0f
Contents?: true
Size: 873 Bytes
Versions: 4
Compression:
Stored size: 873 Bytes
Contents
module ThinkingSphinx::ActiveRecord::AssociationProxy extend ActiveSupport::Concern 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'
Version data entries
4 entries across 4 versions & 1 rubygems