I have one question regarding to time zone
I have done the following yet, my activerecord is not still matching with my timezone when I do following query
Did you try the query by specifying the range?
Because you're trying to find the user_stocks
that are created on some date. But notice that created_at
is a datetime
object and I guess your date
variable might be just a date
object.
def stock_by_date(date)
UserStock.where(created_at: date.midnight..date.end_of_day, user_id: current_user.id)
end