Skip to content
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

Unclear how to turn off validations #202

Open
lawso017 opened this issue Jun 7, 2016 · 2 comments
Open

Unclear how to turn off validations #202

lawso017 opened this issue Jun 7, 2016 · 2 comments

Comments

@lawso017
Copy link
Collaborator

lawso017 commented Jun 7, 2016

In trying to get my existing app to run with master in prep for a new release, the new ActiveRecord validations are causing problems.

First, I do not think it's desirable to add new validations that are turned on by default. Validations in Rails don't work that way -- they're there if you need them, but they're not activated by default.

Second, I can't figure out how actually turn off the validations that are turned "on" by default (Unique Filename and Filename Format). I've tried:

    validates :document, unique_filename: false
    validates :document, filename_format: false

It looks like the validations can only be deactivated in the global Carrierwave config block. But at the moment I've not figured out how to make that work either.

Anyway, not sure we should push out a new release with these defaulting to on. Will likely cause grief for many.

@p8
Copy link
Collaborator

p8 commented Jun 7, 2016

What are the validation error you are getting?
The only validation changes are from ac43297
I agree we should not have breaking changes with a new release.

@lawso017
Copy link
Collaborator Author

lawso017 commented Jun 7, 2016

@p8 my unit tests were failing due to the filename_format and unique_filename validations, which as you noted are new since 0.0.15.

It took me a while to figure out where the failures were coming from; while I could work around them by adjusting my config to turn off the validations, it was an unwelcome surprise.

I'm not totally clear on the use case behind the validations; the syntax presented in the documentation makes them seem like ActiveRecord-type validations (that's how they're implemented), but the fact that several of them default to "true" (i.e. on) is inconsistent with AR validations in general. I.e., you can't actually turn them off within the model, you have to turn them off globally first in your config file.

I really think the validations should all default to false because they are new and haven't been previously enabled for existing users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants