Hey
Thanks for answering.
I figured it out in another way.
Instead of searching for Courses through Projects, I did it the other way
around, and searched through courses and grouping by projects.
Courses is more important. and if no course found, the project wont be
shown either.
Regards
Den tirsdag den 17. juni 2014 20.56.23 UTC+2 skrev Daniel Gottschalck:
>
> Hey
>
>
> In the website, there is "projects", and "projects" can have "courses".
>
>
> In my project index file, how would I filter on "courses" which
> "is_visible" true?
>
> Im confused on whether to use "has" or "indexes" for a relation model
> boolean value.
>
>
>
> ThinkingSphinx::Index.define 'refinery/wayfinders/project', :with =>
> :active_record do
> indexes :name, sortable: true
> indexes :city
> indexes :description
> indexes courses.name, as: :course_name
>
> indexes courses.is_visible, as: :is_visible <------------------------ This
> one?
>
> set_property :group_concat_max_len => 8192
> has zip, external_id
>
>
>
> has courses.is_visible, as: :is_visible, type: :boolean
> <------------------- Or this one?
> end
>
>
> And how would I then filter it in my search_controller? So I only get
> courses which are visible?
>
> @project_search = Refinery::Wayfinders::Project.search(params[:search],
>> :with => { :is_visible => true })
>
>
>
> OR
>
> @project_search = Refinery::Wayfinders::Project.search(params[:search],
>> :include => :is_visible, :conditions => { :is_visible => true })
>
>
>
> Or a third solution?
>
>
> Thanks in advance
>
>
> Regards
>
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/d/optout.