Hello,

I'm running thinking-sphinx 2.0.10 in a Rails 3.2 app.

rvm --version
rvm 1.14.12 (stable) by Wayne E. Seguin <[email protected]>, Michal 
Papis <[email protected]> [https://rvm.io/]

ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2]

This used to be a rails 2.3 app that I'm converting. It always breaks at 
the exact same location with:

    undefined method `association_class' for nil:NilClass

The offending line is:
    @friends = @person.current_friends.order('RAND()').limit(5)

The association is:

In person.rb:
    has_many :current_friends, :source => :friend, :through => :friends

and the sphinx method in person.rb is:
    define_index do
      indexes :user_name
      indexes :id, :as => :id
      indexes :email, :as => :email
      indexes :account_verified#, :as => :account_verified

      set_property :delta => false
    end


In friend.rb:
    belongs_to :person
    belongs_to :friend, :class_name => 'Person', :foreign_key => "friend_id"
    validates_presence_of :person_id, :friend_id

The closes thing I could find that matches my issue 
is: https://github.com/pat/thinking-sphinx/issues/310, I did put the define 
index after all the declarations. I'm sure it's ts because when I comment 
out all define_index methods in the code, it works fine.

This has been hounding me for a long time now.

Thanks for your help,
Ahmed

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/thinking-sphinx/-/rCxKBnWrdrAJ.
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.

Reply via email to