title: access named scope through chained try in my case
body: <p>I am working on old Rails project.</p>
  
  <p>One student can have many courses. Here is my <code>course</code> class (in database, there is <code>courses</code> table):</p>
  
  <pre><code>class Course &lt; ActiveRecord::Base
     ...
     named_scope :active, :conditions =&gt; ‘status is not null’
  end
  </code></pre>
  
  <p>I want to access the first active course from student. I try to be safe, so do it in following way:</p>
  
  <pre><code>student.try(:courses).try(:active).try(:first).try(:name)
  </code></pre>
  
  <p>But I got error:</p>
  
  <pre><code>`undefined method` active' for []:Array`
  </code></pre>
  
  <p>Why is that?</p>
  
  <p>BTW, I can do <code>student.courses.active.first</code></p>