Topic: help me refactor this view please!

<% if tzone == "east" %>
<td><%= (100.00 - v.east)%></td>
<% elsif tzone == "west" %>
<td><%= (100.00 - v.west) %></td>
<% elsif tzone == "central" %>
<td><%= (100.00 - v.central) %></td>
<% elsif tzone == "mountain" %>
<td><%= (100.00 - v.mountain) %></td>
<% end %>

elsewhere I have defined:

 time_zones = {
    :east => 0,
    :central => 1,
    :mountain => 2,
    :west => 3
      }

TIA..

Re: help me refactor this view please!

have you tried something like that?

100.00 - v.time_zones[tzone.intern]

Last edited by vriffier (2008-04-09 07:33:04)