title: undefined method `each' for (need short code to treat object collection that works with 'each' and single obj)
body: <p>Problem:</p>
  
  <p>if returned result single result each method fail - how code can be improved?</p>
  
  <p>The case:</p>
  
  <p>controller action:</p>
  
  <pre><code>@results= Person.find_by_name('Ben');
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>&lt;% if nil!=@results %&gt;
      &lt;% @results.each do |r| %&gt;
         &lt;h2&gt;courses:&lt;/h2&gt; &lt;a href="/course/&lt;%= r.name %&gt;/"&gt;&lt;%= r.name %&gt;&lt;/a&gt;
      &lt;% end %&gt;
  &lt;% else %&gt;
         &lt;h2&gt;no results&lt;/h2&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>undefined method `each' for #&lt;Person id: 2, name: "Ben"&gt;
  </code></pre>
  
  <p>Thanks</p>