Skip to content

Instantly share code, notes, and snippets.

@rafer
Created January 26, 2010 18:38
Show Gist options
  • Save rafer/287085 to your computer and use it in GitHub Desktop.
Save rafer/287085 to your computer and use it in GitHub Desktop.
def model_exists?
begin
potential_model = yield
return ActiveRecord::Base.send(:subclasses).include?(potential_model)
rescue NameError
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment