title: How do I use a form to fill a serialized array in a Rails 4 model?
body: <p>I'm using a <code>form_for</code> to create new <code>Records</code>. Each record has a main photo url <code>:photo</code> and three optional photo urls that I'm storing in a serialized array, <code>other_photos</code>.</p>
  
  <p>In my form, I want to give the user an option to add up to three additional photo urls, which would be stored in <code>other_photos[0]</code>, <code>other_photos[1]</code>, and <code>other_photos[2]</code></p>
  
  <p>I added the column to the database, added <code>serialize :other_photos, Array</code> to the model, and permitted the strong params <code>:other_photos =&gt; []</code></p>
  
  <p>How do I handle this in my form? Right now, I have this for my main photo:</p>
  
  <pre><code>&lt;%= form_for @record do |r| %&gt;
      ...
      &lt;%= label_tag :name, "IMAGE URL:", class: "login-label" %&gt;
      &lt;%= r.text_field :photo, size: 50 %&gt;
  </code></pre>
  
  <p>How do I set the params for <code>other_photos</code>? This doesn't work:</p>
  
  <pre><code>    &lt;%= r.text_field :other_photos[0], size: 50 %&gt;
  </code></pre>