How to reduce number of hierarchical 'if statements' &lt;% @descriptions.each_with_index do |description, i| %&gt;
  &lt;% description.tale2.each do |tax_ref| %&gt;            
    &lt;% if condition %&gt;              
      &lt;% if condition %&gt;
        &lt;% if condition %&gt;                  
          &lt;%= $text_first_describe%&gt; &lt;%= $paren_author_yr %&gt;
             &lt;% ref_sp_uniq.each_with_index do |ref, i| %&gt;
               &lt;% if ref == tax_ref.ref_wo_brace%&gt;
                  &lt;% execution %&gt;                      
               &lt;% elsif i == (ref_sp_uniq.size - 1)%&gt;
                  &lt;%# @ref_desc = "#{@ref_desc_numb}. #{tax_ref.ref_wo_brace}" %&gt;
               &lt;% end %&gt;
             &lt;% end %&gt;
          &lt;% if condition %&gt;
                  &lt;% execution %&gt;                      
          &lt;% elsif condition %&gt;
            &lt;% execution %&gt;
          &lt;% elsif taxon_name.emend_author_year %&gt;                    
             &lt;%= print %&gt;
          &lt;% else %&gt;                    
             &lt;%= print %&gt;                    
          &lt;% end %&gt;
        &lt;% end %&gt;
      &lt;% else %&gt;
        &lt;% if condition %&gt;
          &lt;%= print %&gt;
          &lt;% ref_sp_uniq.each_with_index do |ref, i| %&gt;
             &lt;% if condition %&gt;
                &lt;% execution %&gt;                      
             &lt;% elsif condition %&gt;
                  &lt;% execution %&gt;                      
             &lt;% end %&gt;
          &lt;% end %&gt;
          &lt;% if condition %&gt;
            &lt;% execution %&gt;                      
          &lt;% elsif condition %&gt;
            &lt;% execution %&gt;                      
          &lt;% elsif condition %&gt;
            &lt;% execution %&gt;                      
          &lt;% else %&gt;
            &lt;% execution %&gt;                      
          &lt;% end %&gt;
        &lt;% end %&gt;
      &lt;% end %&gt;
    &lt;% end %&gt;
  &lt;% end %&gt;        
&lt;% end %&gt;
In general, you can try inverting the condition on your outermost if block, and work your way in.  This will often result in less nesting, eg:

if condition1
  if condition2
    #ifblock
  else
    #elseblock2
  end
else
  #elseblock
end


Inside a loop, as you have your code, it would become this strcture, which is less nested:

if !condition
  #elseblock
  next
end
if !condition2
  #elseblock2
  next
end
#ifblock