Created
February 16, 2009 09:29
-
-
Save geoffreyd/65090 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.first_uninteresting | |
last = 0 | |
Number.all(:order => "number").each do |n| # Number.find/all will return an enumerable, so you can each it directly. | |
return last + 1 if n.number.to_i != last + 1 # if's can be on the same line at the end for basic tests | |
last = n.number.to_i #ops forgot the number casting | |
end | |
last + 1 # Ruby will automatically return the last valuation, no need for 'return' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment