OK. so then you need to create your own queries with
Reviews.find_by_sql() and insert appropriate sql statement, eg
select product_id, count(*) as counter from reviews where age between
(10,20) and ... order by 2 desc
tom
Robert Scott wrote:
> Right, but that approach also means that I will be using all reviews for
> all users.
>
> The only reason I'm going through the hassle of trying to make it
> dynamic is so that I could further segment the reviewers. So instead of
> saying X reviewers would buy it again, I could get closer to X reviewers
> in your age group would buy it again or X reviewers in your area, etc.
> etc.
>
>
>
>
> Tom Z Meinlschmidt wrote:
>> easiest and fastest way is to keep number of reviews in column in
>> product table... then simple add :order => 'reviews_count desc' in your
>> Product.find()
>>
>> tom
>>
>> Robert Scott wrote:
>>> belong_to their respective products.
>>>
>>> So my question is this:
>>> How can I structure a query so that I can order products based on the
>>> number of people who would purchase it again?
>>>
>>> It'd be alot easier for me, and probably my server, if I just kept a
>>> running count of those in the actual product record, but I'm trying to
>>> keep it dynamic so that I can create custom reviewer sets elsewhere.
>>>
>>> Thanks in advance for any direction.
>>
>> --
>> ===============================================================================
>> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
>>
>> www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
>> ===============================================================================
>
--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
===============================================================================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---