-
Notifications
You must be signed in to change notification settings - Fork 180
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
filename_valid not compatible with multiple uploader per model changes? #205
Comments
I think we should revert the multicolumn implementation for now. There still are some things we have to workout like |
@p8 thanks for the clarification, you're right about the validations. Now that I'm actually looking at the diff I see what's happening. My unit tests started failing after your last round of PR acceptances. They were failing because of the
I was not using
As it turns out, assigning the key to
However, the new key logic results in:
... in other words, no key is created by default in the testing scenario. It seems like creating a valid key by default in this simple use case is desirable. I'm also not sure of the rationale behind this PR. So at this point I do not see a problem with the multicolumn implementation and think it can remain. Would be happy to add a PR for It looks like the unexpected test failures are limited to this change in PR #198. Appreciate your thoughts on the best way to resolve. Having said that, I agree the new version should be 1.0 based upon the v4 POSTS and dropping 1.9 support. |
@lawso017 sorry for the late reply. You can probably fix this by setting the key in your factory.
|
I can confirm @lawso017's issue and @p8's fix (with some adjustments). However, when directly providing a file, shouldn't Carrierwave Direct set the key for you automatically? This also allows to create EquipmentImports in console, giving it a file which is then automatically uploaded with the correct key being stored in the database. This worked nicely in previous versions. The whole fix that worked for me:
|
When reviewing the code during the effort to disable default validations, noted that we are creating a method
filename_valid?
Reviewing the code raised two questions:
We are only creating one method on the class, and naming it based upon the attribute being mounted; therefore multiple uploaders mounted on a model will not work. Believe we should refactor this method to be
{column}_filename_valid?
so it will be compatible with multiple uploaders per model.This method currently requires that filename validations be enabled either globally or for the uploader attribute being tested, since it simply calls
valid?
on the underlying class. That may be OK... but wondering if it might be better to actually run the validation regexp instead of delegating tovalid?
so the method would give a consistent answer regardless of whether validations are enabled or not?The text was updated successfully, but these errors were encountered: