我正在使用iOS客户端调试我的rails应用程序。它是一个照片共享和上传应用程序,我跟随
我完成了客户端部分,照片显示在cleint周围。下一部分包括从客户端上传图像到服务器是发生错误的地方。我在控制器中使用'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'
答案 0 :(得分:2)