Created
January 4, 2010 14:58
-
-
Save tjboudreaux/268557 to your computer and use it in GitHub Desktop.
This file contains 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.find_scrabble_words ( letters ) | |
words = Array.new | |
(1..letters.size).each do |i| | |
letters.permutation(i).to_a.each{ | |
|word| words.push(word.join("")) | |
} | |
end | |
return self.find(:all, | |
:conditions => ["word in (?)", words.compact ], | |
:order => "score DESC") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment