Skip to content

Instantly share code, notes, and snippets.

@mvr
Created February 16, 2009 23:33
Show Gist options
  • Save mvr/65459 to your computer and use it in GitHub Desktop.
Save mvr/65459 to your computer and use it in GitHub Desktop.
def self.first_uninteresting
numbers = all(:order=>:number, :conditions=>"number >= 0").map(&:number)
highest = numbers.sort.last
missing = (1..highest).to_a - numbers
return highest + 1 if missing.empty?
missing.first
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment