has "COUNT(DISTINCT courses.id) > 0", :as => :has_courses, :type => :boolean
join courses # if you're not referring to the association elsewhere
And then your search would be:
Project.search :with => {:paid => true, :has_courses => true}
Cheers
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>
Would something like this work?
has '(select count(courses.id) from courses where
courses.project_id=projects.id)', :as => :courses_count, :type =>
:integer
I've done something similar in my own project.
-Timo