Module | ActsAsSphinx::ClassMethods |
In: |
plugins/can_has_sphinx/lib/acts_as_sphinx.rb
|
Associates the model class with a sphinx index, which will be used by find_with_sphinx method. You can pass the following options:
:host is the host name or an IP address where searchd daemon is running, default is localhost :port is the port number of the searchd process, default is 3312 :index is the name of the index to be used, default is the name of the table for the current model class.
# File plugins/can_has_sphinx/lib/acts_as_sphinx.rb, line 11 11: def acts_as_sphinx(options = {}) 12: options.assert_valid_keys(SphinxClassMethods::VALID_OPTIONS) 13: 14: default_options = {:host => 'localhost', :port => 3312, :index => name.tableize} 15: write_inheritable_attribute 'sphinx_options', options.reverse_merge(default_options) 16: extend SphinxClassMethods 17: end