title: Uploading multiple files with paperclip
body: <p>I am having problems uploading multiple files using paper clip, </p>
  
  <p>my models are as such</p>
  
  <pre><code>slider has_many imgarrays
  
  imgarrays has_many imageobjects
  
  imageobjects have_attachment(as for paperclip)
  </code></pre>
  
  <p>I have no problems receiving a single image and saving it using paperclip on my other models, but i am not sure of how to handle the array returned by <code>imgarrays</code> param during a multiple file upload. </p>
  
  <p>Here is my rails server logs:</p>
  
  <pre><code>Started POST "/slider" for 127.0.0.1 at 2012-07-23 10:14:17 +0800
    Processing by SliderController#create as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"7HcHtSlOsU/bnxb9emhAsSl/GFBraIE6NxwijHl3REM=", "slider"=&gt;{"question"=&gt;"", "answer"=&gt;"", "score"=&gt;"", "industry_name"=&gt;"", 
    "imgarrays"=&gt;[#&lt;ActionDispatch::Http::UploadedFile:0x007fb471e99f30 @original_filename="Icon.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"slider[imgarrays][]\"; filename=\"Icon.png\"\r\nContent-Type: image/png\r\n", @tempfile=#&lt;File:/var/folders/2s/n9wb5x4534nfs1cbrlph32v00000gp/T/RackMultipart20120723-53499-1lyi4yf&gt;&gt;, #&lt;ActionDispatch::Http::UploadedFile:0x007fb471e99dc8 @original_filename="Icon@2x.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"slider[imgarrays][]\"; filename=\"Icon@2x.png\"\r\nContent-Type: image/png\r\n", @tempfile=#&lt;File:/var/folders/2s/n9wb5x4534nfs1cbrlph32v00000gp/T/RackMultipart20120723-53499-10lala2&gt;&gt;, #&lt;ActionDispatch::Http::UploadedFile:0x007fb471e99d50 @original_filename="greenButton.png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"slider[imgarrays][]\"; filename=\"greenButton.png\"\r\nContent-Type: image/png\r\n", @tempfile=#&lt;File:/var/folders/2s/n9wb5x4534nfs1cbrlph32v00000gp/T/RackMultipart20120723-53499-or2rdk&gt;&gt;]}, "commit"=&gt;"Create!"}
  Completed 500 Internal Server Error in 18ms
  
  ActiveRecord::AssociationTypeMismatch (Imgarray(#70206507050500) expected, got ActionDispatch::Http::UploadedFile(#70206487229960)):
    app/controllers/slider_controller.rb:12:in `new'
    app/controllers/slider_controller.rb:12:in `create'
  
  Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.4ms)
  Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms)
  Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (6.5ms)
  </code></pre>
  
  <p>new.html.erb for slider</p>
  
  <pre><code>&lt;div&gt;
  &lt;%= form_for @slider ,:url=&gt;"/slider" , :html =&gt; { :multipart =&gt; true } do |f| %&gt;
  
        &lt;%= f.label :question , "question"%&gt;
        &lt;%= f.text_field :question %&gt; &lt;/br&gt;
          &lt;%= f.label :answer , "answer array (comma seperated)"%&gt;
            &lt;%= f.text_field :answer %&gt;   &lt;/br&gt;
          &lt;%= f.label :score , "score"%&gt;
       &lt;%= f.text_field :score %&gt; &lt;/br&gt;
              &lt;%= f.label :industry_name , "industry"%&gt;
                &lt;%= f.text_field :industry_name %&gt;    &lt;/br&gt;
  
          &lt;%= f.label :attachedimg , "image"%&gt;
           &lt;%= f.file_field :imgarrays, :multiple =&gt;:true %&gt;  &lt;/br&gt;
  
        &lt;%= f.submit "Create", class: "btn btn-large btn-primary" %&gt;
      &lt;% end %&gt;
  
  &lt;/div&gt;
  &lt;%= link_to 'Cancel', slider_index_path %&gt;
  </code></pre>