Show More
Commit Description:
import problem replaced old one, fixed small problems...
Commit Description:
import problem replaced old one, fixed small problems problem validates name to have no space, test interface can deal with broken dependecies on problems. git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@436 6386c4cd-e34a-4fa8-8920-d93eb39b512e
File last commit:
Show/Diff file:
Action:
app/models/language.rb | 24 lines | 510 B | text/x-ruby | RubyLexer |
class Language < ActiveRecord::Base
@@languages_by_ext = {}
def self.cache_ext_hash
@@languages_by_ext = {}
Language.find(:all).each do |language|
language.common_ext.split(',').each do |ext|
@@languages_by_ext[ext] = language
end
end
end
def self.find_by_extension(ext)
if @@languages_by_ext.length == 0
Language.cache_ext_hash
end
if @@languages_by_ext.has_key? ext
return @@languages_by_ext[ext]
else
return nil
end
end
end