我正在使用 iOS 客户端调试我的 rails 应用程序。它是我关注的照片共享和上传应用程序
我完成了客户部分,照片出现在客户周围。包括从客户端将图像上传到服务器的下一部分是发生错误的地方。我在控制器中使用“puts @photos”语句来查看上传后创建的变量。
这是从设备上传照片后引发的错误
19:07:06 web.1 | Started POST "/photos" for 127.0.0.1 at 2012-09-11 19:07:05 -0700
19:07:06 web.1 | Connecting to database specified by database.yml
19:07:06 web.1 | Processing by PhotosController#create as JSON
19:07:06 web.1 | Parameters: {"photo%5Blat%5D"=>"37.785834",
"photo%5Blng%5D"=>"-122.406417", "photo"=>{"image"=>#
<ActionDispatch::Http::UploadedFile:0x007ff3cf0a3870
@original_filename="image.jpg", @content_type="image/jpeg",
@headers="Content-Disposition: form-data; name=\"photo[image]\";
filename=\"image.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#
<File:/var/folders/dh/1k2rdp_51yd2k43xzkc2pmdh0000gn/T/RackMultipart20120911-22662-1walqgi>>}}
19:07:06 web.1 | Completed 500 Internal Server Error in 55ms
19:07:06 web.1 | ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected attributes: image):
19:07:06 web.1 | app/controllers/photos_controller.rb:51:in `new'
19:07:06 web.1 | app/controllers/photos_controller.rb:51:in `create'