Skip to content

Instantly share code, notes, and snippets.

@thiago-vieira
Created May 14, 2012 13:25
Show Gist options
  • Save thiago-vieira/2693958 to your computer and use it in GitHub Desktop.
Save thiago-vieira/2693958 to your computer and use it in GitHub Desktop.
Deleting all records of all models
Dir["app/models/*.rb"].each do |file|
model = file.gsub("app/models/", "").gsub(".rb", "")
"#{model.camelize}".constantize.unscoped.delete_all rescue nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment