I have three models: Question, User and Qrecord. A Qrecord stores how many times the User has answered the Question correctly (in the column :answered) and when it was last answered (in the column :last_answered).
So, a Question has_many Qrecords and a User has_many Qrecords. A Qrecord belongs_to :user and :question.
Qrecord Model
id :integer not null, primary key user_id :integer question_id :integer answered :integer last_answered :datetime For an array of questions, how do I return the one in which :last_answered was the longest time ago?