title: Using Rails application config variable in model
body: <p>I've defined custom configuration variables in my rails app (APP_CONFIG hash). Ok, now how can I use these variables in my models? Directly calling APP_CONFIG['variable'] in models its a not rails way! For example I can use these models without Rails environment. Then APP_CONFIG not be defined.</p>
  
  <p>ATM I use model observer and assign global config variables with instance variables, like this:</p>
  
  <pre><code>def after_initialize model
    Mongoid.observers.disable :all do
      model.user_id = APP_CONFIG['user_id'])
      model.variable = User.find(model.user_id).variable
    end
  end
  </code></pre>
  
  <p>But this solution looks like a monkey patch. There is better way?</p>
  
  <p>Or I should keep it simplest and can just define APP_CONFIG hash in new app (not Rails app)?</p>