I see! Thanks a lot!
It's actually a lot easier than I thought :-)

On Apr 23, 1:59 pm, Pat Allan <[email protected]> wrote:
> Hi Gedeon
>
> You can't delve into associated objects for excerpts directly - but the 
> excerpts object just looks at methods, not columns, so just create a method 
> that pulls all the association data together, and call that via excerpts 
> instead.
>
>   def wb_content_body
>     writeboards.collect(&:writeboard_contents).flatten.collect(&:body).join(' 
> ')
>   end
>
>   # ...
>
>   project.excerpts.wb_content_body
>
> Cheers
>
> --
> Pat
>
> On 20/04/2010, at 2:10 PM, Gedeon wrote:
>
>
>
> > Hello Pat (and all Thinking Sphinx experts),
>
> > Sorry to bother you again. I hope this problem will be easy to solve!
> > The context is still the same as in my previous thread: Searching
> > projects.
>
> > Projects are linked to several kinds of associated objects.
> > One of these are "writeboards" (which can be considered as some kind
> > of wiki) and each writeboard can have several "writeboard_contents"
> > which are the different versions of the wiki.
>
> > So:
> > A project has many writeboards
> > A writeboard has many writeboard_contents
>
> > My ThinkingSphinx index definition contains:
> > indexes writeboards.writeboard_contents.body, :as => :wb_content_body
>
> > Now, if I search for "blueberry" and that word appears the 'wiki' of
> > project called "pie recipes", how can i let the user know why TS
> > retrieves "Pie recipes"?
> > I would like to use excerpts to display that info, but I cannot seem
> > to get it to work.
> > The example I found onhttp://freelancing-god.github.com/ts/en/excerpts.html
> > only shows excerpts within the searched class (i.e.:
> > article.excerpts.body ) but I cannot see any example of excerpts in
> > associated objects (i.e.: article.excerpts.author.biography)
>
> > I tried several possibilities, but none of them worked:
> > project.excerpts.wb_content_body :
> > undefined method `wb_content_body' for #<Project:0x9737504>
>
> > project.excerpts.writeboards.writeboard_contents.body
> > undefined method `writeboard_contents' for "#&lt;Writeboard:
> > 0x9705888&gt;":String
>
> > Is something like this possible?
> > How can I do it?
>
> > Thanks a lot for your help!
> > Best regards,
>
> > Gedeon
>
> > --
> > 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 
> > athttp://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 
> athttp://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