title: When and where do I require files in a rails application?
body: <p>Let's say I have I have the following file in my lib directory of my rails application:</p>
  
  <pre><code>#lib/proxy.rb
  module SomeService
    class ServiceProxy
      def do_something
      end
    end
  end
  </code></pre>
  
  <p>If I want to use ServiceProxy in a model, I can use it like so:</p>
  
  <pre><code>#app/models/product.rb
  require 'proxy'
  
  class Product &lt; ActiveRecord::Base
    def do_something
      proxy = SomeService::ServiceProxy.new
      proxy.do_something
    end
  end
  </code></pre>
  
  <p>This works, but I noticed if I want to use ServiceProxy in another model, I do not need "require 'proxy'" in the second model file. It seems having "require 'proxy'" once in any model will add it to the lookup path. </p>
  
  <p>Can someone explain this behavior and the best practice surrounding it in a rails app?</p>
  
  <p>Thanks!</p>
  
  <p>UPDATE: 
  Based on floyd's answer below, if my ServiceProxy file was saved as so,</p>
  
  <pre><code>#lib/some_service/service_proxy.rb
  </code></pre>
  
  <p>then I would not have to explicitly require the file. </p>