title: Codeigniter Undefined Property, or how will my controller stop worrying and learn to love the model
body: <p>I am following the tutorial from the <a href="http://codeigniter.com/user_guide/tutorial/news_section.html" rel="nofollow">Codeigniter website</a> about making a news section. Right now I am getting an undefined property message on line 13.</p>
  
  <p>Here is my model. <strong>applications/models/articles_model</strong></p>
  
  <pre><code>&lt;?php
  
  class Articles_model extends CI_Model{
  
      public function __construct(){
  
          $this-&gt;load-&gt;database();
      }
  
      public function get_article($slug = False){
  
          if ($slug === FALSE){
  
               $query = $this-&gt;db-&gt;get('articles');
               return $query-&gt;result_array();
          }
  
          $query = $this-&gt;db-&gt;get('articles');
          return $query-&gt;result_array();
      }
  
      $query = $this-&gt;db-&gt;get_where('articles', array('slug' =&gt; $slug));
      return $query-&gt;row_array();
  }
  </code></pre>
  
  <p>And here is the controller. <strong>applications/controllers/articles.php</strong></p>
  
  <pre><code>&lt;?php
  
  class Articles extends CI_Controller{
  
      public function __contruct(){
  
          parent::__construct();
          $this-&gt;load-&gt;model('Articles_model');
      }
  
      public function index(){
  
          //Message: Undefined property Articles::Articles_model    
          $data['articles'] = $this-&gt;Articles_model-&gt;get_article();
          $data['title'] = "Archive";
  
          $this-&gt;load-&gt;view('templates/header', $data);
          $this-&gt;load-&gt;view('articles/index', $data);
          $this-&gt;load-&gt;view('templates/footer');
      }
  
      public function view($slug){
  
          $data['articles'] = $this-&gt;Articles_model-&gt;get_article($slug);
  
          if(empty($data['articles'])){
  
              show_404();
          }
  
          $data['title'] = $data['articles']['title'];
  
          $this-&gt;load-&gt;view('templates/header', $data);
          $this-&gt;load-&gt;view('articles/view', $data);
          $this-&gt;load-&gt;view('templates/footer');
      }
  }
  </code></pre>
  
  <p>These are all the routes I have setup. <strong>applications/config/routes.php</strong></p>
  
  <pre><code>$route['articles/(:any)'] = 'articles/view/$1';
  $route['articles'] = 'articles';
  $route['default_controller'] = 'pages/view';
  $route['(:any)'] = 'pages/view/$1';
  </code></pre>
  
  <p>My database looks like this</p>
  
  <pre><code>mysql&gt; describe articles
  +-------+--------------+------+-----+---------+----------------+
  | Field | Type         | Null | Key | Default | Extra          |
  +-------+--------------+------+-----+---------+----------------+
  | id    | int(11)      | NO   | PRI | NULL    | auto_increment |
  | title | varchar(128) | NO   |     | NULL    |                |
  | slug  | varchar(128) | NO   | MUL | NULL    |                |
  | text  | text         | NO   |     | NULL    |                |
  +-------+--------------+------+-----+---------+----------------+
  </code></pre>
  
  <p>I have tried using the property with a capital first-letter,<code>$this-&gt;Articles_model</code>, and not, <code>$this-&gt;articles_model</code>.  </p>
  
  <p>Am I missing something stupid?
  If so what is it?<br>
  If it's not stupid how can I debug?</p>
  
  <p><strong>EDIT</strong>  </p>
  
  <p>The ouput of print_r, as per comments, did not contain "Articles_model". The first tier thing is over my head, but CTRL-F isn't. Also the Apache logs mention this...</p>
  
  <pre><code>[Sun Sep 23 13:19:30 2012] [error] [client 127.0.0.1] PHP Fatal error:  Call to a member function get_article() on a non-object in /home/noel/dev/web/
  ci/CodeIgniter_2.1.2/application/controllers/articles.php on line 13
  </code></pre>
  
  <p><strong>EDIT1</strong></p>
  
  <p>I thought I fixed it, but no, see the comment on my <em>answer</em>. For some reason <code>$this-&gt;article_model</code> is not an object. </p>
  
  <p>Why? I've been to one World Fair, a Picnic and a Rodeo and that's the stupidest thing I ever heard come over a set of earphones. You sure you got today's codes?</p>