Ruby on Rails Monday, January 31, 2011

Hi,

I have hierarchical "if loops" like this

<% @descriptions.each_with_index do |description, i| %> <% description.tale2.each do |tax_ref| %>
<% if condition %>
<% if condition %> <% if condition %>
<%= $text_first_describe%> <%= $paren_author_yr %> <% ref_sp_uniq.each_with_index do |ref, i| %> <% if ref == tax_ref.ref_wo_brace%> <% execution %>
<% elsif i == (ref_sp_uniq.size - 1)%> <%# @ref_desc = "#{@ref_desc_numb}. #{tax_ref.ref_wo_brace}" %> <% end %> <% end %> <% if condition %> <% execution %>
<% elsif condition %> <% execution %> <% elsif taxon_name.emend_author_year %>
<%= print %> <% else %>
<%= print %>
<% end %> <% end %> <% else %> <% if condition %> <%= print %> <% ref_sp_uniq.each_with_index do |ref, i| %> <% if condition %> <% execution %>
<% elsif condition %> <% execution %>
<% end %> <% end %> <% if condition %> <% execution %>
<% elsif condition %> <% execution %>
<% elsif condition %> <% execution %>
<% else %> <% execution %>
<% end %> <% end %> <% end %> <% end %> <% end %>
<% end %>

Kindly suggest me possible way to reduce this kind of junk "if loops".


--
With Regards,
Palani Kannan. K,

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment