title: Undefined method/NoMethodError in Rails 3
body: <p>So I am doing a lynda.com Rails essential training tutorial, and I am getting an error that the video tutorial does not. I assume this has to do with the different versions of Ruby &amp; Rails that I am using (the latest as of today) as opposed to the ones they used when this was recorded (I think in 2007).</p>
  
  <p>This is what my controller looks like:</p>
  
  <p>class PublicController &lt; ApplicationController</p>
  
  <pre><code>def album_list
      @albums = Album.find_by_sql('SELECT * FROM albums;')
  end 
  
  def alt_album_list
      release_date = '2011-10-01'
      artist = 'Paul'
      @albums = Album.find(:all, 
          :conditions =&gt; ["release_date &lt;= ? AND artist LIKE ?", release_date, '%' + artist + '%'],
          :order =&gt; 'release_date ASC',
          :limit =&gt; 1, :offset =&gt; 1)
      render(:action =&gt; 'album_list')
  end
  
  def one_album_list
      release_date = '2011-10-01'
      artist = 'Paul'
      @album = Album.find(:first, 
          :conditions =&gt; ["release_date &lt;= ? AND artist LIKE ?", release_date, '%' + artist + '%'],
          :order =&gt; 'release_date ASC')               
  end
  </code></pre>
  
  <p>end</p>
  
  <p>This is what my view looks like:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      Title: &lt;%= @album.title %&gt;&lt;br /&gt;
      Artist: &lt;%= @album.artist %&gt;&lt;br /&gt;
      Genre: &lt;%= @album.genre %&gt;&lt;br /&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The error I get when I load it is:</p>
  
  <pre><code>NoMethodError in Public#show_album
  
  Showing C:/Users/&lt;username&gt;/music_library/app/views/public/show_album.rhtml where line #8 raised:
  
  undefined method `title' for nil:NilClass
  Extracted source (around line #8):
  
  5: 
  6: &lt;body&gt;
  7: 
  8:  Title: &lt;%= @album.title %&gt;&lt;br /&gt;
  9:  Artist: &lt;%= @album.artist %&gt;&lt;br /&gt;
  10:     Genre: &lt;%= @album.genre %&gt;&lt;br /&gt;
  11:     
  Rails.root: C:/Users/&lt;username&gt;/music_library
  
  Application Trace | Framework Trace | Full Trace
  app/views/public/show_album.rhtml:8:in `_app_views_public_show_album_rhtml___574395264_32579964__949661750'
  </code></pre>