I have the following ActiveRecord query that retus a Relation:
result = Trainee.select("users.name, start_date, count(users.id) AS reviews_completed")
.where(user_id: user_ids)
.joins(:user).joins(:reviewers)
.where(reviewers: { completion_time: start_date..end_date.end_of_day })
.group('users.id').order('reviews_completed DESC')
I would like to get a result in the form of [{ name: "Tom", start_date: 7/16/2016, reviews_completed: 5 }, { name: "Sara", start_date: 1/11/2015, reviews_completed: 2 }].
I've seen some similar questions on here, but what is the best way to do this with ActiveRecord Rails 4?
