Check records for the same month

Asked

Viewed 103 times

1

I’m having trouble searching the sqlite3 database, records for a specific month, I searched the internet but I couldn’t find anything that could help me. I have an Account template that has belongs_to with the Situation class that is an Enum where it has paid or pending status. I would like to search the bank, accounts that are of a specific month and are paid but I still can not filter. Any suggestions? I thank you already.

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.

  • 1

    Thanks, gave me a basis so I could better understand the problem and be able to continue in the development of functionality! I thank you for your help and for your attention!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.