I have an array of certain dates called array_of_dates
.
And I have a table called my_table
with columns 'date' and 'count'.
Is there a way I can write an active records query to match the 'date' column in my_table
with array_of_dates
and return hashes ? All keys being the dates from array_of_dates
, and all the values being the 'count' from my_table
; returning zero as the value if a date present in array_of_dates
doesn't exist in column 'date' of my_table
.
Thanks in advance.