Hi Josh

Looks like you're using TS 2.0.0 - can you upgrade to the latest (2.0.3)? I 
have a feeling a bug with joins was fixed in 2.0.1 or later.

Cheers

-- 
Pat

On 07/05/2011, at 8:26 AM, Josh Chu wrote:

> Hi -- I've searched the archives and I see that others have gotten
> this to work, so I suspect I'm doing something obviously wrong.  (I
> see
> http://groups.google.com/group/thinking-sphinx/browse_thread/thread/838aeac0324de622/7076dad15040b578?lnk=gst&q=has_and_belongs_to_many+with+filter#7076dad15040b578
> and this worked).
> In any case, here's my issue.  I have a model that defines
> 'categories' for an ActiveRecord:
> 
>  has_and_belongs_to_many :categories
> 
> and I have in my define_index:
> 
>  has categories(:id), :as => :categories
> 
> However when I try to rebuild my indexes with this I get the following
> error:
> 
> 
> undefined method `with_join_class' for
> #<ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation:
> 0x27390b8>
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/association.rb:67:in `arel_join'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/source/sql.rb:23:in `block in to_sql'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/source/sql.rb:22:in `each'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/source/sql.rb:22:in `to_sql'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/source.rb:103:in `set_source_sql'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/source.rb:50:in `to_riddle_for_core'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/index.rb:114:in `block in to_riddle_for_core'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/index.rb:113:in `each'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/index.rb:113:in `each_with_index'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/index.rb:113:in `to_riddle_for_core'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/index.rb:83:in `to_riddle'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/active_record.rb:223:in `block in to_riddle'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/active_record.rb:222:in `collect'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/active_record.rb:222:in `to_riddle'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/configuration.rb:155:in `block in build'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/configuration.rb:152:in `each'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/configuration.rb:152:in `build'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/tasks.rb:76:in `block (2 levels) in <top (required)>'
> /opt/local/lib/ruby/1.9.1/rake.rb:634:in `call'
> /opt/local/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
> /opt/local/lib/ruby/1.9.1/rake.rb:629:in `each'
> /opt/local/lib/ruby/1.9.1/rake.rb:629:in `execute'
> /opt/local/lib/ruby/1.9.1/rake.rb:595:in `block in
> invoke_with_call_chain'
> /opt/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
> /opt/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
> /opt/local/lib/ruby/1.9.1/rake.rb:581:in `invoke'
> /opt/local/lib/ruby/gems/1.9.1/gems/thinking-sphinx-2.0.0/lib/
> thinking_sphinx/tasks.rb:93:in `block (2 levels) in <top (required)>'
> /opt/local/lib/ruby/1.9.1/rake.rb:634:in `call'
> /opt/local/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
> /opt/local/lib/ruby/1.9.1/rake.rb:629:in `each'
> /opt/local/lib/ruby/1.9.1/rake.rb:629:in `execute'
> /opt/local/lib/ruby/1.9.1/rake.rb:595:in `block in
> invoke_with_call_chain'
> /opt/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
> /opt/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
> /opt/local/lib/ruby/1.9.1/rake.rb:581:in `invoke'
> /opt/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
> /opt/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in
> top_level'
> /opt/local/lib/ruby/1.9.1/rake.rb:2019:in `each'
> /opt/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
> /opt/local/lib/ruby/1.9.1/rake.rb:2058:in
> `standard_exception_handling'
> /opt/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
> /opt/local/lib/ruby/1.9.1/rake.rb:1992:in `run'
> /opt/local/bin/rake:31:in `<main>'
> 
> 
> Any ideas what might be wrong?  It seems as if it can't find the
> association but I can do Entity.categories just fine
> 
> -- 
> 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.

Reply via email to