title: Unable to connect to local PostgreSQL database
body: <p>I created a simple rails application:</p>
  <p><strong>1</strong></p>
  <blockquote>
  <p>$ rails new myapp1 -d postrgresql</p>
  </blockquote>
  <p><strong>2</strong>. Removed <code>/public/index.html</code></p>
  <p><strong>3</strong>. Created the Homecontroller and the actions</p>
  <p><strong>4</strong>. Wrote the routes</p>
  <blockquote>
  <p>myapp1::Application.routes.draw do</p>
  <pre><code>  root :to =&gt; &quot;home#index&quot;
    match 'about' =&gt; 'home#about'
    match 'contacts' =&gt; 'home#contacts'
    match 'projects' =&gt; 'home#projects'
  end
  </code></pre>
  </blockquote>
  <p><strong>5</strong>. Created the views and the default layout</p>
  <p><strong>6</strong>. The bottom line. Here is the database.yml</p>
  <blockquote>
  <p>development:</p>
  <pre><code>  adapter: postgresql
    encoding: unicode
    database: myapp1_db
    host: localhost
    pool: 5
    username: myapp1_user
    password: 1234
   
  test:
    adapter: postgresql
      encoding: unicode
      database: myapp1_db
      host: localhost
      pool: 5
      username: myapp1_user
      password: 1234
  
  production:
    adapter: postgresql
      encoding: unicode
      database: myapp1_db
      host: localhost
      pool: 5
      username: myapp1_user
      password: 1234
  </code></pre>
  </blockquote>
  <p>and of course I created user and database</p>
  <pre><code>sudo -u postgres psql
  postgres=# \password
  postgres=# create user myapp1_user with password '1234';
  postgres=# create database myapp1_db owner myapp1_user; 
  </code></pre>
  <p>But there are some worries:</p>
  <p><strong>1</strong>. Now I don't use any database, but in spite of this the application gives an error</p>
  <blockquote>
  <p>PG::Error FATAL:  Peer authentication failed for user &quot;myapp1&quot;</p>
  </blockquote>
  <p><strong>2</strong>. It seems like rails turns a blind eye to <code>database.yml</code>. Why does it use the user <strong>myapp1</strong> instead of <strong>myapp1_user</strong>?</p>