-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple file uploads #1481
Conversation
I think this is a good change. We can write about that change(to_json behavior) and also release it as a major(1.0+ anyone?). |
@jnicklas Awesome...merged. There are two specs that this breaks (from recent PRs I merged yesterday). I marked them pending in f88ebde. For one of them, it seems If you have a bit to take a peek, I'd appreciate it, otherwise I'll try to dig in next week. Thanks! |
@jnicklas Also it looks like this doesn't work on Rails 3.2 :( https://travis-ci.org/carrierwaveuploader/carrierwave/builds/41521188 Quick fix or going to be brutal? |
Looks like Rails 3.2 doesn't support the |
Hi, just some notes about the introduced API from random guy: @jnicklas Have you considered to add a new "multiple" option to the existing My rationale:
Until this new and undoubtedly great function gets into stable version, what do you think about Thank you! |
I think it would be nice, I was going back and forth between those two options as well. Unfortunately it wouldn't really help with the duplication you pointed out in (3), while all of this code is very similar, if you look closely it is not the exact same. I tried to dry up and extract as much as possible. Putting both in the same method would make the code quite messy, I think, but just because they are implemented in separate methods doesn't mean they can't have a common API. |
You're absolutely right about the proper code separation, I'm reviewing only from the perspective of API consumers and I just mean that maybe you could win a few keystrokes if you've chosen the option variant (so it was an additional but not important point). No claims or worries about the code, it's great for me. |
I confirmed that my comment is actually incorrect. When mounted, the output of |
This adds pretty effortless support for multiple file uploads, via a new
mount_uploaders
method (note the plural-s).All the tests pass when run against fog 1.23.0, but #1480 causes failure against 1.24.0 which is why this is red on Travis.
I've tried to not change any existing behaviour, but this makes one backwards incompatible change. The behaviour of
to_json
has been changed when serializing an uploader which is not mounted on a model. This removes the need to overrideserializable_hash
on records, which is super, super hacky and shouldn't have been done in the first place IMO. This drastically simplifies the implementation.This is a huge change which touches a lot of files and refactors and changes a lot of very old code. As such I'm a bit apprehensive about it, but as a feature this is totally amazing. Drop it in with multiple file upload and it just works.
@bensie et al, please take a look and let me know what you think.