For some reason, one of my params (file upload) always is nil. Here is the params hash in the exception page that is shown:
{"utf8"=>"✓",
"_method"=>"put",
...
"avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fe7fa1dd460 @original_filename="rp.jpg",
@content_type="image/jpeg",
@headers="Content-Disposition: form-data; name=\"user[avatar]\"; filename=\"rp.jpg\"\r\nContent-Type: image/jpeg\r\n",
@tempfile=#<File:/var/folders/44/xrz6nqg91_l_gzmhxt8s771c0000gn/T/RackMultipart20111107-12870-nguhuw>>},
"commit"=>"Update",
"id"=>"1"}
In my controller, I have if params["avatar"], but avatar is always returning nil.
avataris likely nested within another element. By omitting important details, we can’t tell, but I can tell that your dump has an unbalanced}on the line starting with@tempfile, so it’s likely that the matching{appears before"avatar"=>and thus it is nested within another hash.You might try something like
params[:user][:avatar], or whatever the actual name of your model is.