Skip to content

Instantly share code, notes, and snippets.

@Stenerson
Created January 31, 2014 03:36
Show Gist options
  • Save Stenerson/8726239 to your computer and use it in GitHub Desktop.
Save Stenerson/8726239 to your computer and use it in GitHub Desktop.
My most proud ruby method so far. A method to find the candidates that a user needs to take action on. Probably makes no sense without context - too bad.
def candidate_queue
self.campaigns.collect do |x|
x.candidates.select {|y| y.owners.compact.include?(self) }
end.flatten.sort! {|a,b| a.updated_at <=> b.updated_at }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment