Given the following:

buyable = DB[:product_listings].where(:buyable => true)                     
                        
recent  = DB[:product_listings].where("start_sale_date > now() - interval 
'1 day'")

What's the best way to find all recent buyable products?  (Ideally, without 
using Sequel::Model)

In AR, I'd do:

class ProductListing
  scope :buyable, where(:buyable => true)
  scope :recent, where("start_sale_date > now() - interval '1 day'")
end
ProductListing.buyable.recent

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/q4lcrOAP1CIJ.
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/sequel-talk?hl=en.

Reply via email to