Q:

Hidden fields, creating local instance variable in the view, GOOD or BAD? 

This is my partial:
<%= form_for(item, :url => update_cart_path) do |item_form| %>
<tr>
    <% @variant = item.variant %>
    <%= hidden_field(:variant, :id) %>
    <td width="300"><%=item.variant.product.name%> <%= "(" + variant_options(item.variant) + ")" unless item.variant .option_values.empty? % ></td>
    <td class="price"><%= number_to_currency item.price %></td>
    <td class="qty"><%=item.quantity%></td>
    <td class="total"><span><%= number_to_currency (item.price * item.quantity)%></span></td>
    <td class="edit"><%= link_to(image_tag('/images/admin/icons/edit.png'), '#', :class => 'edit') %>
    </td>
</tr>
<% end %>

And I'm calling it as follows:
<%= render :partial =>'shared/cart/line_item' , :collection => @order.line_items, :as => :item %>

I have to create a local variable @variant for the hidden_field to work, and because it doesn't make any sense creating it in the controller, I have created the instance local variable in the view. 
Is there a better design for this? 

A:

If you are only doing that for the hidden_field helper to work, you can use hidden_field_tag instead:
<%= hidden_field_tag('variant', item.variant.id) %>

