title: Cakephp error:Call to a member function find() on a non-object
body: <p>I am having problems with my code. When I try to debug my web application I get the following error message....Call to a member function find() on a non-object.....here is my code</p>
  
  <p>
  
  <p>class TeamsController extends AppController {</p>
  
  <pre><code>var $name = 'Teams';
  
  function index() {
  $this-&gt;set('teams', $this-&gt;team-&gt;find('all'));
  
  }
  
  function Welcome() {
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am trying to display records from my MySQL database. Now with that said, I did this tutorial and I followed the instructions down to the tee.....but somehow my code has bugs. The only difference between my code and the code of the tutorial I did is the variable names...and the controller names....and the I dont have the hello world function... Here is a sample of the code from the tutorial I did....</p>
  
  <p>
  
  <p>class PostsController extends AppController {</p>
  
  <pre><code>var $name = 'Posts';
  
  function index() {
      $this-&gt;set('posts', $this-&gt;Post-&gt;find('all'));
  }
  
  function hello_world() {
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>With that said, am I suppose to declare an instance of an object to get this to work?</p>