title: Rails custom class
body: <p>I'd like to create a global instance of a class that is in a file in <code>/lib</code>. I can access this class and initialize it in my controllers like so:</p>
  
  <pre><code>message_queue = MessageQueue.new
  </code></pre>
  
  <p>However, I would like to have a global version of this that would persist as long as the rails session is running (This is an experiment. I don't want to use a model for this).</p>
  
  <p>I initialized variables in <code>application.rb</code> by doing:</p>
  
  <pre><code>config.autoload_paths &lt;&lt; Rails.root.join('lib')
  </code></pre>
  
  <p>so that they are global, to make sure the class can be found. However, I get an error: <code>uninitialized constant RPG::Application::MessageQueue (NameError)</code> when I initialize the variable.</p>
  
  <p>How can I make an instance of <code>MessageQueue</code> a global variable I can access everywhere?</p>