mercredi 27 juillet 2016

Active record AND Operator

how do i turn this into one WHERE statement? I want to look for records where a property is an apartment and also is for sale.

def apartment
    @apartments_for_sale = Property.where(for_sale: true)
    @real_apartments = @apartments_for_sale.where(apartment: true)
end

Thanks a lot!

Aucun commentaire:

Enregistrer un commentaire