title: Why won't my viewer display the results of the method?
body: <p>happy is a integer variable that I have set as either 0 or 1. If it's 0 I want to display "No" and if it's 1 I want to display "Yes"</p>
  
  <p>In my controller I have:</p>
  
  <pre><code>helper_method :happy_to_text
  def happy_to_text(happy)
    happy &gt; 0 ? 'Yes' : 'No'
  end
  
  def edit
    @todo_item = @todo_list.todo_items.find(params[:id])
  end
  </code></pre>
  
  <p>If I try:</p>
  
  <pre><code>&lt;td&gt;&lt;%= happy_to_text(1) %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>it works correctly, displaying "Yes"</p>
  
  <p>If I try:</p>
  
  <pre><code>&lt;td&gt;&lt;%= todo_item.happy %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>it works correctly, displaying "1"</p>
  
  <p>If I try:</p>
  
  <pre><code>&lt;td&gt;&lt;%= happy_to_text(@todo_item.happy) %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>It fails with the error:</p>
  
  <pre><code>"undefined method `&gt;' for nil:NilClass"
  </code></pre>
  
  <p>I'm sure I'm missing something basic, but I'm stuck. Any help would be appreciated.</p>