Skip to content

Instantly share code, notes, and snippets.

@lightyrs
Created December 8, 2011 21:36
Show Gist options
  • Save lightyrs/1448727 to your computer and use it in GitHub Desktop.
Save lightyrs/1448727 to your computer and use it in GitHub Desktop.
Rails List All Models
ActiveRecord::Base.connection.tables.map do |model|
model.capitalize.singularize.camelize
end
# returns ["Activity", "Article", "User", "Video", "Vote"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment