I think what Pat's trying to say is add another attribute/field that will
enforce the join of the comments table.

Add another field like

has comments.another_attribute, :as => :comment_another_attribute, :type =>
:attribute_type

On Sun, Jul 18, 2010 at 12:23 AM, Maechi <[email protected]> wrote:

> Hi Pat,
>
> There is an error saying:
>
> ERROR: index 'top_remcord_container_core': sql_range_query: Unknown
> column 'comments.rating' in 'field list' (DSN=mysql://
> prod:*...@localhost:3306/prod_development).
>
> I dont understand, what you meant with refering to the comments
> association in another field... Is that the reason for this failure?
>
> there exists a reference to comments and there is a int field called
> rating.
>
> Thanks for your help...
> Markus
>
> On 17 Jul., 05:09, Pat Allan <[email protected]> wrote:
> > 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]<thinking-sphinx%[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]<thinking-sphinx%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
>


-- 
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

-- 
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