Closed gbrl closed 7 years ago
Glad you got it working! The thing is that you're specifying confit for myAwesomeDropzone
but your form isn't matching that. Please, take a look at how Dropzone handles configuration and you should get that working without the params hack :)
Nahuel Cuesta Luengo @ncuestal · nahuelcuestaluengo@gmail.com
On Nov 1, 2016, 16:02 -0300, Gabriel Rambert notifications@github.com, wrote:
So I got it working with my basic Upload scaffold, however, specifying the field name in the dropzone config wasn't working, so here is my solution. I hacked the _params method to assign the [:file] parameter into the [:upload][:my_cv] key.
def upload_params params[:upload][:my_cv] = params[:file] params.require(:upload).permit(:name, :my_cv, :upload, :file) end
Is this bad? I don't think I should add this to the README since it's a hack, but when I tried using the config, it had no effect:
document.addEventListener("turbolinks:load", function() { Dropzone.options.myAwesomeDropzone = { paramName: "upload[my_cv]", // The name that will be used to transfer the file maxFilesize: 2 } $("#new_upload").dropzone(); })
Maybe I'm doing something wrong here. Anyways, feel free to answer if you like. Or close the issue.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/ncuesta/dropzonejs-rails/issues/38), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAF1aKb5ig6b8Xnvf6kanLTYqcRQ7jC9ks5q54ywgaJpZM4KmdFn).
LOL Thanks for pointing out my obvious mistake. I'll work on this some more and find a proper solution. You can close if you wanna.
So I got it working with my basic Upload scaffold, however, specifying the field name in the dropzone config wasn't working, so here is my solution. I hacked the _params method to assign the [:file] parameter into the [:upload][:my_cv] key.
Is this bad? I don't think I should add this to the README since it's a hack, but when I tried using the config, it had no effect:
Maybe I'm doing something wrong here. Anyways, feel free to answer if you like. Or close the issue.