Skip to content

Instantly share code, notes, and snippets.

def model_exists?(model_name)
begin
potential_model = model_name.constantize
rescue NameError
return false
end
ActiveRecord::Base.send(:subclasses).include?(potential_model)
end
# Should the contestant switch to the other door?
@switch = true
@wins = 0; @losses = 0
100000.times do
# Hide the car
car_behind = rand(3)
# Contestant picks a door
contestant_pick = rand(3)