Hi Raghu Unfortunately, TS isn't quite smart enough to pay attention to eager includes on association definitions (though a patch is welcome, if you want to have a go at it).
What may help matters is adding a reference to the association yourself: has favourite_answer.question(:id), :as => :question_id This will force the join in the generated query. Hope it helps. -- Pat On 27/02/2010, at 9:15 PM, Raghu wrote: > Hello, > > I am using thinking sphinx in one of my projects. > Indexing of eager loaded associations is not working for me. I dont > know if any one faced this issue earlier. > > Following is my model for surveys...where I was eager loading the > questions using :include for retrieval of favorite answer > > class Survey < ActiveRecord::Base > has_many :questions > has_many :answers > > has_one :favorite_answer, :as => :profile, :class_name => > "Answer", :conditions => "questions.about = 'favorite' ", :include > => :question > > define_index do > indexes "login" , :as => :name, :sortable => true > > has favorite_answer.value, :as => :favorite, :type => :integer > has :updated_at, :sortable => true > end > end > > When I run rake ts:index its breaking and giving error some thing like > unknow column 'about' > > When I checked configuration file, I don't see any join for eager > loaded question model(:include => :question) in > sphinx.development.conf > > Can any suggest solution for the above issue... > > Thanks > Raghu > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
