I have a question relating to minimizing some code I'm working with. I am using the map-fields plugin/gem to allow my user to select what fields in a CSV file will map to attributes in a model.
The map-fields plugin uses the name of a select object in the plugin to determine where the CSV columns match up too. Here is my current code to get this all integrated.
<% i = 1 %>
<% @rows[0].each do |row| -%>
<tr>
<td><%= select_tag "fields[#{i}]", options_for_select(@fields), :include_blank => true, :class => 'field_options' %></td>
<td><%= h(row) %></td>
</tr>
<% i += 1 %>
<% end -%>
I want to clean this up a bit and instead of using 'i' I'd like to use some fancy ruby code to make it look clean.
Any thoughts?