title: Unable to debug cakephp error Call to a member function find() on a non-object
body: <p>Here is my model</p>
  
  <pre><code>&lt;?php
  class Survey extends AppModel {
  
      // model associations
      public $belongsTo = array( 
      'Organisation' =&gt; array( 
        'className' =&gt; 'Organisation', 
        'foreignKey' =&gt; 'organisation_id' 
      ),
      'Account' =&gt; array( 
        'className' =&gt; 'Account', 
        'foreignKey' =&gt; 'account_id' 
      ),
      'User' =&gt; array( 
        'className' =&gt; 'User', 
        'foreignKey' =&gt; 'user_id' 
      ),
      'Country' =&gt; array( 
        'className' =&gt; 'Country', 
        'foreignKey' =&gt; 'country_id' 
      ),
      'Currency' =&gt; array( 
        'className' =&gt; 'Currency', 
        'foreignKey' =&gt; 'currency_id' 
      )
    );
  
  }
  ?&gt;
  </code></pre>
  
  <p>and here is my controller</p>
  
  <pre><code>&lt;?php
  class SurveysController extends AppController {
  public $components = array('Session');
  public $uses = array('Report', 'Mycase', 'Workflow');
  
  public function add($type = null, $id = null) {
  
      if (!$id || !$type) {
              throw new NotFoundException(__('Invalid link'));
          }
  
      $type = Inflector::camelize($type);
  
      // this populates the form select for country allowing the country from the report to be prepopulated
      $countries = $this-&gt;$type-&gt;Country-&gt;find('list');
      $this-&gt;set(compact('countries'));
  
      // this populates the form select for currency
      $currencies = $this-&gt;Survey-&gt;Currency-&gt;find('list');
      $this-&gt;set(compact('currencies'));
  
      $resources = $this-&gt;$type-&gt;find('first',
          array(
          'conditions' =&gt; array($type.'.id' =&gt; $id, $type.'.account_id' =&gt; $this-&gt;Session-&gt;read('Auth.User.account_id')),
          'recursive' =&gt; -1 //int
          ));
      if (!$resources) {
              throw new NotFoundException(__('You are not authorised to access that location'));
          }
      $this-&gt;set('resources', $resources);
  
  }
  
  }
  </code></pre>
  
  <p>The error lies in this line of code in the controller</p>
  
  <pre><code>$currencies = $this-&gt;Survey-&gt;Currency-&gt;find('list');
  </code></pre>
  
  <p>I have a database table with Currencies in it and I am trying to populate that to the Survey view in a select. I have checked that the model and controller are named correctly. My associations are similar to the country select that I am also using, which works properly, but I am getting this error on the Currency lookup and I have been trying to debug for hours.</p>
  
  <pre><code>Fatal Error
  Error: Call to a member function find() on a non-object 
  File: C:\xampp\htdocs\cakephp2-5-3\app\Controller\SurveysController.php 
  Line: 29
  </code></pre>