title: Iteratively creating multiple file input fields in Rails
body: <p>I have a column of product views in a database (e.g. top, bottom, front, back). I'm trying to generate a series of file inputs to allow the user to upload an image for each view. This is the result I'm after:</p>
  
  <pre><code>...
  &lt;label&gt;Top&lt;/label&gt;
  &lt;input type="file" name="image[Top]"&gt;&lt;br&gt;
  &lt;label&gt;Bottom&lt;/label&gt;
  &lt;input type="file" name="image[Bottom]"&gt;&lt;br&gt;
  &lt;label&gt;Front&lt;/label&gt;
  &lt;input type="file" name="image[Front']"&gt;&lt;br&gt;
  ...
  </code></pre>
  
  <p>This is what I'm trying:</p>
  
  <pre><code>&lt;%= views = View.order('name ASC').all.map { |view| [view.name, view.id] } %&gt;
  &lt;%= views.each { |view| label(view); file_field('image', view) } %&gt;
  </code></pre>
  
  <p>However, all this does is print out the <code>views</code> array a couple of times. Hopefully you Rails experts can point me in the right direction. (I apologize in advance if I'm butchering Ruby.)</p>