title: View logic with a block and conditional rails
body: <p><img src="https://i.stack.imgur.com/jVFLC.png" alt="enter image description here">I'd like some seasoned veteran advice on how I can find my answer. I know I have too much of the logic in my view, and I'm repeating myself but I'm still trying to "learn by doing" and this is about where I'm at to just get it working and I would learn how to refactor from there of course. </p>
  
  <p>I want to iterate over a logistics created and if the logistics_title (passed through by a form of either "X", "Y", or "Z") matches "X" then display X in a div otherwise don't display anything. </p>
  
  <pre><code>&lt;div class="container-fluid"&gt;
  &lt;div class="row-fluid"&gt;
  &lt;div class="span4 hero-unit"&gt;
     &lt;% @logistics.each do |logistic| %&gt;
        &lt;% if logistic.logistic_title = "Practice" %&gt;&lt;br&gt;
         &lt;%= logistic.logistic_title %&gt;
         &lt;%= logistic.user.full_name %&gt;
         &lt;%= logistic.content %&gt;&lt;br&gt;
         &lt;%= link_to time_ago_in_words(logistic.created_at) + " ago", logistic %&gt; |
         &lt;%= link_to "Edit", edit_logistic_path(logistic) %&gt; |
         &lt;%= link_to "Remove", logistic, method: :delete, data: { confirm: "Remove? This action cannot be undone."} %&gt; 
       &lt;% else %&gt;
        &lt;%= puts "" %&gt;  
       &lt;% end %&gt; 
     &lt;% end %&gt;
  &lt;/div&gt;
  &lt;div class="span4 hero-unit"&gt;
    &lt;% @logistics.each do |logistic| %&gt;
       &lt;% if logistic.logistic_title = "Game" %&gt;&lt;br&gt;
        &lt;%= logistic.logistic_title %&gt;
        &lt;%= logistic.user.full_name %&gt;
        &lt;%= logistic.content %&gt;&lt;br&gt;
        &lt;%= link_to time_ago_in_words(logistic.created_at) + " ago", logistic %&gt; |
        &lt;%= link_to "Edit", edit_logistic_path(logistic) %&gt; |
        &lt;%= link_to "Remove", logistic, method: :delete, data: { confirm: "Remove? This action cannot be undone."} %&gt; 
      &lt;% else %&gt;
       &lt;%= puts "" %&gt;  
      &lt;% end %&gt; 
    &lt;% end %&gt;
  &lt;/div&gt;
  &lt;div class="span4 hero-unit"&gt;
    &lt;% @logistics.each do |logistic| %&gt;
       &lt;% if logistic.logistic_title = "Etc." %&gt;&lt;br&gt;
        &lt;%= logistic.logistic_title %&gt;
        &lt;%= logistic.user.full_name %&gt;
        &lt;%= logistic.content %&gt;&lt;br&gt;
        &lt;%= link_to time_ago_in_words(logistic.created_at) + " ago", logistic %&gt; |
        &lt;%= link_to "Edit", edit_logistic_path(logistic) %&gt; |
        &lt;%= link_to "Remove", logistic, method: :delete, data: { confirm: "Remove? This action cannot be undone."} %&gt; 
      &lt;% else %&gt;
       &lt;%= puts "" %&gt;  
      &lt;% end %&gt; 
    &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
   </p>
  
  <p>I know I'll need to write some helper stuff but a point in the right direction helps. 
  Please be gentle, this is how I learn. </p>
  
  <p>Thanks for taking a look and for your attention. </p>