title: Rails: how can I access the request object outside a helper or controller?
body: <p>In my <code>application_helper.rb</code> file I have a function like this:</p>
  
  <pre><code>def internal_request?
    server_name = request.env['SERVER_NAME']
    [plus more code...]
  end
  </code></pre>
  
  <p>This function is needed in controllers, models, and views. So, I put this code in a utility function file in the <code>lib/</code> directory. However, this did not work: I got complaints about <code>request</code> not being defined. </p>
  
  <p>How can I access the <code>request</code> object in a file in the <code>lib/</code> directory?</p>