Sha256: 01069b28614965d438f73ac33a0c7b58775a2bc979bfae26d0e72c62f91535e2
Contents?: true
Size: 909 Bytes
Versions: 1
Compression:
Stored size: 909 Bytes
Contents
module ThinkingSphinx module ActiveRecord module CollectionProxyWithScopes def self.included(base) base.class_eval do alias_method_chain :method_missing, :sphinx_scopes alias_method_chain :respond_to?, :sphinx_scopes end end 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 def respond_to_with_sphinx_scopes?(method) proxy_association.klass.respond_to?(:sphinx_scopes) && proxy_association.klass.sphinx_scopes.include?(scope) || respond_to_without_sphinx_scopes?(method) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thinking-sphinx-2.0.7 | lib/thinking_sphinx/active_record/collection_proxy_with_scopes.rb |