See records from the same month

1

I'm having difficulty searching the sqlite3 database, records for a specific month, I searched the internet but found nothing that could help me. I have an account template that has belongs_to with the class Location that is an enum where it has pending or paid status. I would like to search the bank, accounts that are of a specific month and are paid but still can not filter. Any suggestion? Thanks in advance.

    
asked by anonymous 25.07.2017 / 22:14

1 answer

0

You can use Conta.where("created_at = ? AND situacao_id = ?", 1.month.ago, id_da_situacao)

"1.month.ago" and "id_da_situacao" are the parameters used in Query.

    
26.07.2017 / 14:01