I’m stumped on this one and haven’t found anything to help me yet. Any
input is welcomed. I’m sure this isn’t too hard for a Rails/SQL wizard.
Basically, I want to order a listing based on the number of hits in the
last x amount of time.
I have a model with a has_many association.
class Item < ActiveRecord::Base
class Hit < ActiveRecord::Base
and I want to do a find that essentially goes like this:
Item.find :all, :order => “…the number of hits found for the item over
the last x amount of time”
I don’t really want a where clause, because I want all items… I just
want them weighted by the number of hits in that amount of time.
Thanks in advance.