Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to connect to local PostgreSQL database
    primarykey
    data
    text
    <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; "home#index" 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 "myapp1"</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>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload