title: (Ruby) ActiveRecord with PG try to connect with local user to remote server
body: <p>I made a simple-coding-ruby-program for get backups from remote server, and I made a db in postgresql for save information and schedule backups.</p>
  
  <p>The connect with DB was done with ActiveRecord, I configured for access a internal DB (in other server), but when I try to connect to remote db, i get this message: </p>
  
  <pre><code>/usr/lib/ruby/1.8/active_record/connection_adapters/postgresql_adapter.rb:968:in `initialize': FATAL:  no existe el rol &lt;&lt;mi_user_name&gt;&gt; (PGError)
      from /usr/lib/ruby/1.8/active_record/connection_adapters/postgresql_adapter.rb:968:in `connect'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/postgresql_adapter.rb:968:in `connect'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:223:in `send'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout'
      from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
      from /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
      from /usr/lib/ruby/1.8/active_record/base.rb:3113:in `quoted_table_name'
      from /usr/lib/ruby/1.8/active_record/base.rb:1684:in `construct_finder_sql'
      from /usr/lib/ruby/1.8/active_record/base.rb:1548:in `find_every'
      from /usr/lib/ruby/1.8/active_record/base.rb:1505:in `find_initial'
      from /usr/lib/ruby/1.8/active_record/base.rb:613:in `find'
      from main.rb:84:in `main'
      from main.rb:126
  </code></pre>
  
  <p>PG try to connect to remote db with my local user, in the declaration of ActiveRecord I set the parameters:</p>
  
  <pre><code>require 'active_record'
  
      ActiveRecord::Base.establish_connection(
          :adapter  =&gt; "postgresql",
          :host     =&gt; "xxx.xxx.x.101",
          :port     =&gt; 5432,
          :database =&gt; "VB_DB",
          :user     =&gt; "pg_user",
          :password =&gt; "blahblah"
      )
  </code></pre>
  
  <p>I working with Ruby 1.8.7.</p>
  
  <p>Any idea about this?</p>
  
  <p>thank for reading, and help me.</p>
  
  <p>Grettings.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I found the solution:</p>
  
  <blockquote>
  <pre><code>    ActiveRecord::Base.establish_connection(
          :adapter  =&gt; "postgresql",
          :host     =&gt; "xxx.xxx.x.101",
          :port     =&gt; 5432,
          :database =&gt; "VB_DB",
          :username =&gt; "pg_user",
          :password =&gt; "blahblah"
      )
  </code></pre>
  </blockquote>
  
  <p>I used :user and must be :username. 
  Shame on me.</p>