title: Rails Controller/Model methods
body: <p>I am watching Code School Rails testing course. There is an instance of the class <code>zombie</code>. The <code>zombie</code> model has a method:</p>
  
  <pre><code>def avatar_url
    ...
  end
  </code></pre>
  
  <p>Within the test, <code>.rb</code> file has the following:</p>
  
  <pre><code>z.avatar_url
  </code></pre>
  
  <ol>
  <li>When I call a method like this, how does Rails distinguish if I'm calling a controller or model method? I hadn't thought of calling a model method from other than a controller, and  only like <code>Model.method</code> and not <code>object.method</code>.</li>
  <li>If both my controller and my model have a method with the same name, how would Rails know which one to call?</li>
  </ol>
  
  <p><strong>Update:</strong></p>
  
  <p>Lets take the class String as example, it is not a model, right?</p>
  
  <p>So I could say:</p>
  
  <pre><code>s = String.new
  s.capitalize
  </code></pre>
  
  <p>If this call doesn't go to a model and not to a controller, where does it go then? Where would a class like String be defined in the Rails directory?</p>