只是想知道这样构造语句的正确方法是什么?
@products = Product.where('release_date <= ?', Date.today AND 'physical_status' == 'active')
谢谢!
答案 0 :(得分:2)
您正在寻找的是:
@products = Product.where('release_date <= ? AND physical_status = ?', Date.today, 'active')
您可以查看本指南:http://guides.rubyonrails.org/active_record_querying.html