title: If Condition in each do Rails
body: <p>Hi i need to print out just the candidates where active is == 0 here is my code in the view.</p>
  
  <p>I can print if active is yes or no.. But in the each do loop i just want to print the active candidates.</p>
  
  
  
  
  So how can i add the condition to my each do loop, thanks.
  
      
  
  <pre><code>  &lt;% @candidates.each do |candidate| %&gt;
      &lt;div id="candidateper"&gt;
    &lt;div class="avatth" &gt;&lt;div class="avat_min"&gt;
      &lt;% if candidate.avatar.present? %&gt;
         &lt;%= link_to (image_tag candidate.avatar.url(:thumb)), (candidate_path(candidate))  %&gt;
       &lt;% else %&gt;
       &lt;%= link_to (image_tag ("espanol/playersample.png")), (candidate_path(candidate))  %&gt;
  
       &lt;% end %&gt;
    &lt;/div&gt;&lt;/div&gt;
  
  
  
        &lt;div class="nameth"&gt;&lt;%= candidate.name %&gt;&lt;/div&gt;
        &lt;div class="activeth"&gt;&lt;%= candidate.active ? t('generales.yess') : t('generales.noo') %&gt;&lt;/div&gt;
        &lt;div class="generalth"&gt;
          &lt;% if candidate.user.purchased_at.present? %&gt;
            &lt;%= candidate.user.purchase_defeated? ? t('generales.defeated') : t('generales.active') %&gt;
          &lt;% else %&gt;
            &lt;%=  t('generales.noo') %&gt;
          &lt;% end %&gt;
        &lt;/div&gt;
  
        &lt;div class="actionsth"&gt;&lt;%= link_to t('generales.show'), candidate_path(candidate) %&gt;
        &lt;% if current_user.user_type == 'admin' %&gt;
        &lt;%= link_to t('generales.delete'), candidate_path(candidate), method: :delete, data: { confirm: t('generales.delete_candidate_confirm') } %&gt;
       &lt;% end %&gt;
      &lt;/div&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
  &lt;/div&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p>I`ve tried this</p>
  
   
  
  <p>no luck syntax error on all my ideas :P</p>