title: Rails 4: Unpermitted parameter
body: <p>I have a model Picture where I take a photo with webcam and save it. I upload the images with carrierwave, and generate the image with the gem <a href="https://github.com/timsly/carrierwave-data-uri" rel="nofollow">carrrierwave-data-uri</a> The image is sent by ajax</p>
  
  <p><strong>the function on my PicturesController.rb is:</strong></p>
  
  <pre><code>def upload_image
      photo = params[:picture][:photo]   
      @picture = Picture.new(picture_params)
      @picture.user_id = current_user.id 
      @picture.photo = photo
      @picture.save
    end
  
  
    private
      def set_picture
        @picture = Picture.find(params[:id])
      end
  
      def picture_params
        params.require(:picture).permit(:photo, :comment, :user_id )
      end
  end
  </code></pre>
  
  <p><strong>My Ajax</strong></p>
  
  <pre><code>function save_photo() {
    Webcam.snap( function(data_uri) {
  
      $.ajax({
        type: 'POST',
        url: '/pictures/upload',
        async: true,
        data: { picture: {photo: data_uri} }
      })
  
      .done(function () {
        console.log(photo);
      });
  
      Webcam.reset();
  
    } );
  }
  </code></pre>
  
  <p>When I send the image, it is registered on database, but not the image. I getting the console error:</p>
  
  <p>Unpermitted parameter: image</p>
  
  <p>But if I add the parameter <strong>:image</strong> on my strong parameters, I get the <strong>Completed 500 Internal Server Error</strong></p>
  
  <p>The data uri is printed on my console, but I can't put it in a <strong>image</strong> variable</p>
  
  <p>Thanks by help!</p>