title: Rails 3.1 with jQuery-File-Upload and nested Paperclip
body: <p>I'm using Rails 3.1 with Paperclip and looking for a way to implement jQuery-File-Upload.<br /></p>
  
  <p>I've a basic working setup by following the example:<br />
  <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/jQuery-File-Upload-v4-for-Rails-3" rel="nofollow">blueimp jquery=file-upload</a><br /></p>
  
  <p>But when I introduced a nested attributes model where uploads are nested within post, it falls apart. The error given is "unknown attribute: picture". Understand that the uploads_attributes may have to be marshaled separately, particularly for picture params, from the query script to the controller. How do I go about specifying the params?</p>
  
  <p>Request: <a href="http://localhost:3002/posts/3" rel="nofollow">http://localhost:3002/posts/3</a></p>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>ActiveRecord::UnknownAttributeError in PostsController#update
  
  unknown attribute: picture
  
  Rails.root: /Users/mjwong/workspace/testupload
  Application Trace | Framework Trace | Full Trace
  
  app/controllers/posts_controller.rb:63:in `block in update'
  app/controllers/posts_controller.rb:62:in `update'
  </code></pre>
  
  <p>Request</p>
  
  <p><strong>Parameters:</strong></p>
  
  <pre><code>{"utf8"=&gt;"✓",
   "_method"=&gt;"put",
   "authenticity_token"=&gt;"1SYnIX+Y5PxM7PskzV/zocCJfh60tyGkUBdwu7OmNo8=",
   "post"=&gt;{"title"=&gt;"test",
   "content"=&gt;"test",
   "picture"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x007fe346dbeaf8 @original_filename="Alva 2.jpg",
   @content_type="image/jpeg",
   @headers="Content-Disposition: form-data; name=\"post[picture]\"; filename=\"Alva 2.jpg\"\r\nContent-Type: image/jpeg\r\n",
   @tempfile=#&lt;File:/var/folders/_w/24l2jy1563d2qqh8w0x4qmgh0000gn/T/RackMultipart20111030-3671-10zn91c&gt;&gt;},
   "commit"=&gt;"Update Post",
   "id"=&gt;"3"}
  </code></pre>
  
  <p><strong>Models:</strong><br /></p>
  
  <pre><code>class Post &lt; ActiveRecord::Base
     has_many :uploads, :dependent =&gt; :destroy
     accepts_nested_attributes_for :uploads, :allow_destroy =&gt; true
  end
  
  class Upload &lt; ActiveRecord::Base
     belongs_to :post
     has_attached_file :picture, :styles =&gt; {:thumb   =&gt; "100x100#",
                                             :small   =&gt; "300x300&gt;",
                                             :large   =&gt; "600x600&gt;" },
     :url =&gt; "/system/:class/:attachment/:id/:style/:basename.:extension",
     :path =&gt; ":rails_root/public/system/:class/:attachment/:id/:style/:basename.:extension"
  
     validates_attachment_size :picture, :less_than =&gt; 500.kilobytes
     validates_attachment_content_type :picture, :content_type =&gt; ['image/jpeg', 'image/png']
  end
  </code></pre>
  
  <p><strong>Controllers:</strong></p>
  
  <pre><code>class HomeController &lt; ApplicationController
     def index
        @upload  = Upload.new
     end
  end
  </code></pre>