Note that there are some explanatory texts on larger screens.

plurals
  1. PORails and MySQL - ActiveRecord::ConnectionNotEstablished in production environment
    primarykey
    data
    text
    <p>I'll try to be short:<br /> Using <i>Rails 3.2.1</i> and <i>mysql2</i> for databases; running on Ubuntu 11.10<br /> In <i>development</i> environment everything works just fine<br /> When I start my server <i>(WEBrick)</i> in <i>production</i>, it boots up fine, but after loading any page, it raises the following error:<br /></p> <pre><code>ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished): activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in retrieve_connection' activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection' activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection' ... /home/metjush/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' /home/metjush/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' /home/metjush/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' </code></pre> <p>After trying to find any possible source of error, and consulting like a billion different websites and similar reports, I am still not able to find what's wrong. My <i> database.yml</i> (running on localhost right now, and have my settings in production environment the same as for development, which works) is fine, my <i>Gemfile</i> is alright (gem 'mysql2' included, don't worry), the production database is created and rake db:migrate had no problems migrating it... Any other possible source of error I did not think of or did not find on the internet?<br /></p> <p><b>I stress, this only happens in production</b></p> <p>Thanks for your help</p> <hr> <p><b>EDIT</b> Posting my Gemfile:<br /></p> <pre><code>source 'https://rubygems.org' gem 'rails', '3.2.1' gem 'mysql2' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~&gt; 3.2.3' gem 'coffee-rails', '~&gt; 3.2.1' gem 'uglifier', '&gt;= 1.0.3' end gem 'jquery-rails' gem 'bcrypt-ruby', :require =&gt; 'bcrypt' gem 'rufus-scheduler' gem 'gmaps4rails' </code></pre> <p>Hope this helps - although I don't really see anything wrong with it.</p> <p><strong>EDIT TWO</strong><br /> Oddly enough, I have no problems when I start the rails console in the production environment - MySQL queries work, model instances can be saved without problems. I only get the aforementioned error when I try to access the database from the browser.</p>
    singulars
    1. This table or related slice is empty.
    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