How can I select ALL student students from my database with active status only in the month of May? I couldn't find it in the active record documentation. I only managed to query the students who were created in May, and not ALL students actived....
Student.where(status:'active', created_at: ('2021-05-01'..'2021-05-31')).count
actually, my idea would go something like this:
Student.where(status:'active', datetime: (('2021-05-01'..'2021-05-31')).count
You need to parse the Date like so:
You could also let Rails set the beginning and end of the month:
If status ist an enum you can also query like this: