UltraSphinx help anyone?

Hey Everyone,

So I posted a thread last night with my problem, but since then I have figured out the syntax a little better. I am trying to create indexes on 2 separate models. I have an Account model that "has_many :names"

class Account < ActiveRecord::Base

has_many :names, :dependent => :destroy

is_indexed :fields => ['s_property_no'],     :include => [{:association_name => "name", :field => 'name', :as => 'property_name'}]

How do I setup the association between the account and name? When I do rake ultrasphinx:configure, I get an error that says " You have a nil object when you didn't expect it! The error occured while evaluation nil.constantize. For some reason it's not seeing my "name" model.

Here's the name model...

class Name < ActiveRecord::Base   belongs_to :account

Any help is appreciated.



Ha, I figured it out. I spent most of yesterday, and this morning on this, and it was simple (usually is). I had my "is_indexed" defined in the wrong model. It had to be defined in my name model rather than my account model. It seems a little backwards in my head, but it works now.

Ok, so I got it working. My is_indexed was defined in the wrong model. Here's what I put in the "name" model rather than the "account" model.

# Thinking Sphinx Search criteria   is_indexed :fields => ['name','address','city','state','zip'],     :include => [{:association_name => 'account', :field => 's_property_no', :as => 's_property_no'},                  {:association_name => 'account', :field => 's_service_address', :as => 's_service_address'}

Does anyone know how I reference the 'name', 'address, etc from a view within the account controller views? I can access the "s_property_no, s_service_address" just fine. I'm not sure how I refer to the other fields I am search on so I can display them in the search results.



For my view code you can look here...


I would love advice from anyone, I am just taking stabs in the dark right now.