title: Carrierwave Can't mass-assign protected attributes: path when uploading using jquery-fileupload-rails
body: <p>I'm trying to get a simple file upload working using</p>
  
  <ul>
  <li>jquery-fileupload-rails</li>
  <li>carrierwave</li>
  <li>fog</li>
  </ul>
  
  <p>I cannot find the cause of the following error</p>
  
  <pre><code>Started POST "/pictures" for 127.0.0.1 at 2012-07-27 15:19:37 +0100
  Processing by PicturesController#create as JSON
    Parameters: {"utf8"=&gt;"✓",
    authenticity_token"=&gt;"NKek0e/kfVRUk4SVBjokO5rL446dKvHo9+7mKuH0HKs=", "picture"=&gt;   
    {"path"=&gt;#  &lt;ActionDispatch::Http::UploadedFile:0x00000002d48fa8 
    @original_filename="IMG_0001.JPG", @content_type="image/jpeg", @headers="Content-
    Disposition: form-data; name=\"picture[path]\"; filename=\"IMG_0001.JPG\"\r\nContent-
    Type: image/jpeg\r\n", @tempfile=#&lt;File:/tmp/RackMultipart20120727-7807-1bcbfof&gt;&gt;}}
  Completed 500 Internal Server Error in 1ms
  
  ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected attributes: 
  path):
    app/controllers/pictures_controller.rb:9:in `new'
    app/controllers/pictures_controller.rb:9:in `create'
  </code></pre>
  
  <p>The model, controller and view are taken from</p>
  
  <p><a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Rails-setup-for-V6" rel="nofollow">https://github.com/blueimp/jQuery-File-Upload/wiki/Rails-setup-for-V6</a></p>
  
  <p>The error message leads me to think that I need to make 'path' accessible, but how? Note that the jquery-file-upload bit is working (I have got the bootstrap buttons, the pictures appear on screen, etc, only the file upload itself obviously does not work!)</p>
  
  <p>For completeness, this is picture.rb:</p>
  
  <pre><code>class Picture &lt; ActiveRecord::Base
  
    include Rails.application.routes.url_helpers
    attr_accessible :avatar
    mount_uploader :avatar, AvatarUploader
  
    def to_jq_upload
      {
        "name" =&gt; read_attribute(:avatar),
        "size" =&gt; avatar.size,
        "url" =&gt; avatar.url,
        "thumbnail_url" =&gt; avatar.thumb.url,
        "delete_url" =&gt; picture_path(:id =&gt; id),
        "delete_type" =&gt; "DELETE" 
      }
    end
  end
  </code></pre>
  
  <p>The corresponding controller is</p>
  
  <pre><code>class PicturesController &lt; ApplicationController  
  
    def index
      @pictures = Picture.all
      render :json =&gt; @pictures.collect { |p| p.to_jq_upload }.to_json
    end
  
    def create
      @picture = Picture.new(params[:picture])
      @picture.save!
      if @picture.save
        respond_to do |format|
          format.html {  
            render :json =&gt; [@picture.to_jq_upload].to_json, 
            :content_type =&gt; 'text/html',
            :layout =&gt; false
          }
          format.json {  
            render :json =&gt; [@picture.to_jq_upload].to_json     
          }
        end
      else 
        render :json =&gt; [{:error =&gt; "custom_failure"}], :status =&gt; 304
      end
    end
  
    def destroy
      @picture = Picture.find(params[:id])
      @picture.destroy
      render :json =&gt; true
    end
  
  end
  </code></pre>
  
  <p>This is the uploader class:</p>
  
  <pre><code>class AvatarUploader &lt; CarrierWave::Uploader::Base
  
    storage :file
  
    def store_dir
      "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
    end
  
  
  end
  </code></pre>