in application creating form uploads multiple document. have posted form 2 upload documents not able save in database due error. getting parameters mentioned above. please me out solve issue.
in controller:
def create @sr_document = srdocument.new(sr_document_params) end def sr_document_params params.require(:sr_document).permit(:file_type, :file, :service_request_id, :file_file_name, :file_content_type, :file_file_size) end
in log:
"sr_document"=>{"file"=>[
@tempfile=#, @original_filename="reliance web-chat.pdf", @content_type="application/pdf", @headers="content-disposition: form-data; name=\"sr_document[file][]\"; filename=\"reliance web-chat.pdf\"\r\ncontent-type: application/pdf\r\n">,
@tempfile=#\, @original_filename="flipkart.pdf", @content_type="application/pdf", @headers="content-disposition: form-data; name=\"sr_document[file][]\"; filename=\"flipkart.pdf\"\r\ncontent-type: application/pdf\r\n">
]}
you getting array of file, think getting issue: try permit file attribute as:
def sr_document_params params.require(:sr_document).permit(:file_type, :file => [], :service_request_id, :file_file_name, :file_content_type, :file_file_size) end
Comments
Post a Comment