Aaron Brethorst

Round peg in a square hole, rabid generalist.

Solution for Undefined Method `sphinx_scope'

| Comments

Running into undefined_method errors with Thinking Sphinx and sphinx scopes?

Make sure you define your sphinx_scope after the define_index block, instead of before.

Simple, huh?

In other words, make sure your ActiveRecord classes look like this:

class ContrivedExample < ActiveRecord::Base
  define_index do
    has :something
  end
  sphinx_scope(:something_cool) { :with => {:something => 10} }
end

Comments