我遇到了一个奇怪的问题: 我正在使用带有rails 3.0.9的paperclip 2.3.16
我有一个模型上传,其中包含属性照片作为附件has_attached_file :photo,
。
在客户端,一切似乎都可以。调用Upload create动作并调用@ upload.save方法但返回false。
当我查看/ tmp文件时,我看到照片已正确上传和处理(有调整大小和水印处理)但公共/系统目录和数据库中没有任何内容。
服务器日志给出:
Started POST "/uploads" for 192.168.1.10 at 2011-08-14 19:51:29 +0200
Processing by UploadsController#create as JSON
Parameters: {"Filename"=>"photos_irlande_gr.jpg", "folder"=>"/properties/", "property_uploadtoken"=>"fHTVm09QCxMwn2dKOjIcWca+tFTxgW10", "_site_session"=>"BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlODk2MTZhNzg3NzQ3YjBhZmIwOTUyMzIzOGNkYzY5MzFJIhBfY3NyZl90b2tlbgY7AEZJIjFTS29ZUHpNalhBQXFPZEYzU0xOT3c1QlNUR2FmK0xwUDNrTzNvMzlpZmhjPQY7AEY=--47d7b48ddc0f75e56b05f61cdbe519bbf692020a", "authenticity_token"=>"SKoYPzMjXAAqOdF3SLNOw5BSTGaf+LpP3kO3o39ifhc=", "fileext"=>"*.jpg;*.jpeg;*.gif;*.png", "Filedata"=>#<ActionDispatch::Http::UploadedFile:0xa472048 @original_filename="photos_irlande_gr.jpg", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"Filedata\"; filename=\"photos_irlande_gr.jpg\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<File:/tmp/RackMultipart20110814-1818-1lba9ph>>, "Upload"=>"Submit Query"}
Upload Load (0.4ms) SELECT `uploads`.* FROM `uploads` WHERE (updated_at < '2011-08-14 16:51:29' AND property_id IS NULL)
#<Upload:0xa107700>
SQL (0.3ms) LOCK TABLES uploads WRITE
SQL (0.4ms) SELECT COUNT(*) FROM `uploads` WHERE `uploads`.`uploadtoken` = 'fHTVm09QCxMwn2dKOjIcWca+tFTxgW10'
=========save begin========
SQL (0.2ms) BEGIN
SQL (0.1ms) ROLLBACK
=========save end========
SQL (0.1ms) BEGIN
SQL (0.1ms) ROLLBACK
CACHE (0.0ms) SELECT COUNT(*) FROM `uploads` WHERE `uploads`.`uploadtoken` = 'fHTVm09QCxMwn2dKOjIcWca+tFTxgW10'
SQL (0.1ms) UNLOCK TABLES
这是上传创建动作的开始
def create
#remove orphelin photos
clean_uploads
newparams = coerce(params)
@upload = Upload.new(newparams[:upload])
logger.debug @upload
@success= true
#critical section begin
lock
check_limitation
logger.debug "=========save begin========"
@upload.save
logger.debug "=========save end========"
之前我遇到过回形针问题,但至少我在服务器日志上遇到了错误。这一次没什么。怎么调查?