Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add association-filtered faceting to CollectionProxy

  • Loading branch information...
commit ecb085404bdf3bf904826875cb30abfd8a7e5b40 1 parent ed22a0e
@pixeltrix pixeltrix authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 lib/thinking_sphinx/active_record/collection_proxy.rb
View
17 lib/thinking_sphinx/active_record/collection_proxy.rb
@@ -2,16 +2,23 @@ module ThinkingSphinx
module ActiveRecord
module CollectionProxy
def search(*args)
- options = args.extract_options!
- options[:with] ||= {}
- options[:with].merge! default_filter
+ proxy_association.klass.search(*association_args(args))
+ end
- args << options
- proxy_association.klass.search(*args)
+ def facets(*args)
+ proxy_association.klass.facets(*association_args(args))
end
private
+ def association_args(args)
+ options = args.extract_options!
+ options[:with] ||= {}
+ options[:with].merge! default_filter
+
+ args + [options]
+ end
+
def attribute_for_foreign_key
if proxy_association.reflection.through_reflection
foreign_key = proxy_association.reflection.through_reflection.foreign_key
Please sign in to comment.
Something went wrong with that request. Please try again.