Hi Markus You'll have to use a SQL snippet for this attribute:
has 'AVG(comments.rating)', :as => :average_rating, :type => :float I think this should do the trick. Make sure you're referring to the comments association in another field or attribute to enforce the join. Cheers -- Pat On 16/07/2010, at 1:16 AM, Maechi wrote: > Hi, > > I have the following Model: > > container (has many) comments (has attribute rating (0 to 5)) > > I want to index the average rating of all comments of one container. > > Is this possible? > > Thanks > Markus > > > -- > 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.
