title: How to submit a string array in a form Rails 4.2
body: <p>I have a model <code>message</code> with a string array attribute <code>recipients</code>. Here's what my <code>messages_controller.rb</code> looks like:</p>
  
  <pre><code>def new
    @message = Message.new
    @message.attachments = params[:attachments]
  end
  def create
    @message = Message.new(create_params)
    @message.user_id = current_user.id
    @message.attachments = params[:message][:attachments]
    @message.recipients = params[:message][:recipients]
    save_message or render 'new'
  end
  private
    def create_params
      params.require(:message).permit(:object, :content,
                                    :recipients,
                                    :attachments)
    end
  </code></pre>
  
  <p>And the _fields.html.erb looks like this:</p>
  
  <pre><code>&lt;%= render 'shared/error_messages', object: f.object %&gt;
  &lt;%= f.label :object %&gt;
  &lt;%= f.text_field :object, class: "form-control" %&gt;
  &lt;%= f.label :recipients %&gt;
  &lt;%= f.text_field :recipients, multiple: true, class: "form-control" %&gt;
  &lt;%= f.label :attachments %&gt;&lt;br&gt;
  &lt;%= f.file_field :attachments, multiple: true, class: 'form-control' %&gt;&lt;br /&gt;
  &lt;%= f.label :content %&gt;
  &lt;%= f.text_area :content, class: "form-control" %&gt;
  </code></pre>
  
  <p>The problem is that it saves the <code>recipients</code> array like this:</p>
  
  <pre><code>["recipient_1, recipient_2"]
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>["recipient_1", "recipient_2"]
  </code></pre>
  
  <p>I want to be able to retrieve recipient[0] = recipient_1 and not recipient[0] = whole array.</p>
  
  <p>It's probably something simple, but I can't find the fix.
  All inputs appreciated.
  Thanks</p>