module ThinkingSphinx::ActiveRecord::CollectionProxyWithScopes

Public Class Methods

included(base) click to toggle source
# File lib/thinking_sphinx/active_record/collection_proxy_with_scopes.rb, line 4
def self.included(base)
  base.class_eval do
    alias_method_chain :method_missing, :sphinx_scopes
    alias_method_chain :respond_to?, :sphinx_scopes
  end
end

Public Instance Methods

method_missing_with_sphinx_scopes(method, *args, &block) click to toggle source
# File lib/thinking_sphinx/active_record/collection_proxy_with_scopes.rb, line 11
def method_missing_with_sphinx_scopes(method, *args, &block)
  klass = proxy_association.klass
  if klass.respond_to?(:sphinx_scopes) && klass.sphinx_scopes.include?(method)
    klass.search(:with => default_filter).send(method, *args, &block)
  else
    method_missing_without_sphinx_scopes(method, *args, &block)
  end
end
respond_to_with_sphinx_scopes?(method) click to toggle source
# File lib/thinking_sphinx/active_record/collection_proxy_with_scopes.rb, line 20
def respond_to_with_sphinx_scopes?(method)
  proxy_association.klass.respond_to?(:sphinx_scopes) &&
  proxy_association.klass.sphinx_scopes.include?(method) ||
  respond_to_without_sphinx_scopes?(method)
end