title: Heroku undefined method error in ActionView
body: <p>Heroku logs shows the following error:</p>
  
  <pre><code>ActionView::Template::Error (undefined method `accepted_answer_id' for #&lt;Question:0x000000052fd1e0&gt;)
  </code></pre>
  
  <p>As background, I have a model <code>Question</code>, which <code>has_many</code> Answers.  <code>Question</code> also has a column <code>accepted_answer_id</code>.</p>
  
  <p>The undefined method error is referring a line in <code>_question.html.erb</code>, where its used to customized the display of the answer count in a different shaded background </p>
  
  <pre><code>  &lt;% if question.answers.count &gt; 0 %&gt; 
  
      &lt;% if question.accepted_answer_id %&gt;
          &lt;div class="pickedanswer"&gt;
            &lt;h4&gt;&lt;%= question.answers.count %&gt;&lt;/h4&gt;
          &lt;/div&gt;
      &lt;% else %&gt;
          &lt;div class="numanswer"&gt;
            &lt;h4&gt;&lt;%= question.answers.count %&gt;&lt;/h4&gt;
          &lt;/div&gt;
      &lt;% end %&gt;
  
    &lt;% else %&gt;
  
        &lt;div class="noanswer"&gt;
          &lt;h4&gt;&lt;%= question.answers.count%&gt;&lt;/h4&gt;
        &lt;/div&gt;
  
    &lt;% end %&gt;
  </code></pre>
  
  <p>I think the error may be raised due to the fact that initially <code>question.accepted_answer_id</code> is <code>nil</code>.. but given the way I structured the logic I do not know why it couldn't simply follow along (as it has done successfully in development).</p>
  
  <p>Thanks for your help.</p>