title: Initialize constants with values from DB in Rails
body: <p>I have a Rails v 2.0.2 application.
  I'd like to initialize a constant in initializers/constants.rb and set its value from DB.</p>
  
  <p>smth like this:</p>
  
  <pre><code>SESSION_DURATION = SystemDB::Configuration.get('session_duration', 0).to_i.minutes
  </code></pre>
  
  <p>So i've got a Configuration table in PostgreSQL with row where name = 'session_duration'.
  This code works fine on my local Windows PC but it fails on production server with Linux with error: <strong>`retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)</strong></p>
  
  <p>It seems to me that at the time rails initializes the constants.rb file ActiveRecord has not been initialized yet. What can i do with it? </p>
  
  <p>By The Way. I use this constant in module - so it must me initialized as soon as possible. (if i understand well)</p>