Skip to content

Instantly share code, notes, and snippets.

@andrei512
Created August 13, 2012 11:48
Show Gist options
  • Save andrei512/3339936 to your computer and use it in GitHub Desktop.
Save andrei512/3339936 to your computer and use it in GitHub Desktop.
@problems = MonitorTask.where("date < '#{1.month.ago}'").includes(:problem).collect { |task| task.problem }
@problems.sort! { |x, y|
@count[y.id] ||= @problems.count { |p| p.id == y.id} <=>
@count[x.id] ||= @problems.count { |p| p.id == x.id}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment