title: How to use secrets.yml in ruby on rails 4 to store a password in database.yml
body: <p>I have a ruby on rails 4 project and my config/secrets.yml looks like this:</p>
  
  <pre><code>development:
    secret_key_base: verylongnumber
    postgres: 'mypassword'
  </code></pre>
  
  <p>My config/database.yml</p>
  
  <pre><code>default: &amp;default
    adapter: postgresql
    encoding: unicode
    # For details on connection pooling, see rails configuration guide
    # http://guides.rubyonrails.org/configuring.html#database-pooling
    pool: 5
    host: localhost
    username: myusername
    password: 'mypassword' # &lt;-- Problem here
  </code></pre>
  
  <p>What do I need to type in password in my config/database.yml, to get the password from secrets.yml?</p>
  
  <p>I tried:</p>
  
  <pre><code>password: &lt;%= ENV['postgres'] %&gt;
  password: &lt;%= ENV["postgres"] %&gt;
  password: &lt;%= ENV[postgres] %&gt;
  password: ENV['postgres']
  password: ENV["postgres"]
  password: ENV[postgres]
  </code></pre>
  
  <p>But neither of these solutions worked. Where did I go wrong? Thanks in advance!</p>