Skip to content

Instantly share code, notes, and snippets.

@ogawaso
Created May 18, 2012 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogawaso/2724445 to your computer and use it in GitHub Desktop.
Save ogawaso/2724445 to your computer and use it in GitHub Desktop.
delete_all of all models
Dir.glob("app/models/*.rb").
map{|m|m.gsub("app/models/", "")}.
map{|m| m.gsub(".rb", "")}.each do |m|
clazz = m.classify.constantize
next unless clazz.kind_of?(ActiveRecord::Base)
clazz.delete_all
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment