I am using rails with postgres. I have a table called 'attempts' which belongs to a 'users' table. I want to retrieve all attempts but only show the latest attempt for each user.
So I want code something like this:
Attempt.group(:user_id).having('latest(created_at)')
The above code does not work.