I have a many-to-one relationship between the models User and Comment.
I would like to collect, preferably in a hash, all comments made by a set of users the 24 hours prior to each user's last comment (including his/her last comment).
This is what I have come up with, but I dont know how to create the hash with comments only from the time span mentioned.
Comment.order('updated_at desc').where(user_id: array_of_users_ids).group_by(&:user).each do |user, comments|
# rearrange the hash here?
end