samedi 20 septembre 2014

Unpermitted parameters in Carrierwave file upload


Vote count:

0




I have Rails 4 + CarrierWave + Nested form for Ad model which as many Image (mount PictureUploader as picture)


When I try to add or edit Ad, I have unpermitted parameters picture



Parameters: {"utf8"=>"✓",
"ad"=>{
"title"=>"plot",
"images_attributes"=>
{ "0" =>
{
"picture"=>[#<ActionDispatch::Http::UploadedFile:0x007fbea1ddedb8 @tempfile=#<Tempfile:/var/folders/t8/fm77jh7j6232v5km2llkgq1r0000gn/T/RackMultipart20140921-33609-54hs6k>, @original_filename="New-york-rental-apartment-1-.gif", @content_type="image/gif", @headers="Content-Disposition: form-data; name=\"ad[images_attributes][0][picture][]\"; filename=\"New-york-rental-apartment-1-.gif\"\r\nContent-Type: image/gif\r\n">],
"_destroy"=>"false"
}
}
}
}

Unpermitted parameters: parent_id
Unpermitted parameters: parent_id
Unpermitted parameters: picture


I permitted the param with following. (according to this Rails Guide, my code should be working)



params.require(:ad).permit(:picture, :title, :images_attributes => [:picture, :id, :_destroy])


I only get fallback picture from carrierwave and now I'm clueless.



asked 1 min ago







Unpermitted parameters in Carrierwave file upload

Aucun commentaire:

Enregistrer un commentaire