Hi Chris

Fields and indexes don't add methods to your models - they just index data from 
those associations with the given names. Also, Sphinx doesn't return field 
data, so there's no way of extracting this information.

In short, within your Rails app, you'll need to use 
pages.collect(&:content).join(' '), not page_contents.

Cheers

-- 
Pat

On 26/02/2011, at 3:06 AM, cbrady wrote:

> I'm having a problem with associations.
> 
> My model looks like this:
> 
> class Article < Content
>  has_many :pages, :dependent => :destroy, :order => 'order_id'
> 
>  define_index do
>    indexes title
>    ...
>    indexes pages.content, :as => :page_contents
> 
>  end
> end
> 
> But when I try to access the page_contents field I get an undefined
> method error.
> 
> I'm using thinking-sphinx 1.3.11 and rails 2.3.5 if it is of any use.
> 
> I have tried other associations too and none of them seem to work.
> 
> Thanks,
> Chris
> 
> -- 
> 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