I am using the strong_parameters shortcut with Rails 3.2. To test the image upload process, I have an incoming mail request with parameters:
{"photo"=>{"image"=>#<Rack::Test::UploadedFile:0x000000069ce1f8 @content_type="image/png", @original_filename="test.png", @tempfile=#<Tempfile:/tmp/test.png20130420-9529-1xuka4v-1>>, "status"=>"approved", "in_use"=>false}, "controller"=>"member/photos", "action"=>"create"}
How to enable image attribute for assignment? I tried;
params.require(:photo).permit(:image)
but he does not work and speaks Validation failed: Image can't be blank.
When I resolve all parameters with params.require(:photo).permit!, it works fine.
source
share