title: Disabling specific groups of rake tasks
body: <p>I'm working with a large Rails application, and i've been tasked with disabling rake tasks that could be harmful if run on our production environments, such as db:migrate, reset, etc.  However i'm not sure what the best course of action here is.</p>
  
  <p>So far my solution is to put a statement like this at the top of the databases.rake task</p>
  
  <pre><code>if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'
  </code></pre>
  
  <p>Now obviously this disables all the database rake tasks for all environments but development and test.  However, i feel like this is hacky and I dont like it.  Can anyone think of a better way to solve this problem, or does this solution pose any greater problems that I may not be realizing?</p>
  
  <p>EDIT:  A side question to a problem i've encountered.  When i set my RAILS_ENV to 'production' via</p>
  
  <pre><code>export RAILS_ENV=production
  </code></pre>
  
  <p>That worked fine, however i need to set my environment back to the default ' ' environment.  When I try</p>
  
  <pre><code>export RAILS_ENV=
  </code></pre>
  
  <p>I get an error  </p>
  
  <pre><code>No such file or directory - project_path/config/environments/.rb
  </code></pre>
  
  <p>Does anyone know how to reset the environment back to default?</p>