title: "rails server" using the wrong database
body: <p>I recently switched a relatively new rails app from sqlite3 to Amazon RDS and configured my <code>database.yml</code> file to use the RDS database in the production environment only.</p>
  
  <p>But now, whenever I try to do any local action on my database (e.g. <code>rails server</code>, <code>rails console</code>, <code>rake db:migrate</code>, etc.) it does that action to the production DB on Amazon's servers rather than my local sqlite3 DB, which is my development DB.</p>
  
  <pre><code># database.yml
  
  development:
      adapter: sqlite3
      database: db/development.sqlite3
      pool: 5
      timeout: 5000
  
  test:
      adapter: sqlite3
      database: db/test.sqlite3
      pool: 5
      timeout: 5000
  
  production:
      adapter: mysql2
      host: mydb.mydbhost.us-east-1.rds.amazonaws.com
      reconnect: false
      database: mydb
      username: myusername
      password: mypassword
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>UPDATE: Here's my environment.rb file:</p>
  
  <pre><code># environment.rb
  
  # Load the rails application
  require File.expand_path('../application', __FILE__)
  
  # Heroku environment variables for local use
  heroku_env = File.join(Rails.root, 'config', 'heroku_env.rb')
  load(heroku_env) if File.exists?(heroku_env)
  
  # Initialize the rails application
  Myapp::Application.initialize!
  </code></pre>