Module: ThinkingSphinx::ActiveRecord::HasManyAssociation

Defined in:
lib/thinking_sphinx/active_record/has_many_association.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/thinking_sphinx/active_record/has_many_association.rb', line 13

def method_missing(method, *args, &block)
  if responds_to_scope(method)
    @reflection.klass.
      search(:with => default_filter).
      send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#search(*args) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/thinking_sphinx/active_record/has_many_association.rb', line 4

def search(*args)
  options   = args.extract_options!
  options[:with] ||= {}
  options[:with].merge! default_filter
  
  args << options
  @reflection.klass.search(*args)
end