Skip to content

Instantly share code, notes, and snippets.

@kml
Created May 22, 2015 09:06
Show Gist options
  • Save kml/114d56e21a133a02244f to your computer and use it in GitHub Desktop.
Save kml/114d56e21a133a02244f to your computer and use it in GitHub Desktop.
Rakefile - disable db: tasks in production
# Idea from: http://www.developingandstuff.com/2014/06/disable-dangerous-rake-tasks-in.html
if Rails.env.production?
Rake::Task.tasks.each do |task|
next unless task.name.start_with?("db:")
Rake::Task[task].enhance do
abort "This task is disabled in production."
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment