Add support for if/unless validator options#239
Add support for if/unless validator options#239dblock merged 1 commit intomongoid:masterfrom knovoselic:feature/conditional_validators_support
Conversation
|
Definitely need to fix CI first. |
|
@knovoselic interested in helping out with maintaining this library? If @rodrigopinto doesn't object I can add you here and rubygems. |
|
Maybe you can finish #216 too? :) |
|
FYI, this PR broke semver of this gem as it was released as 4.2.0 (tiny version bump)--it caused many of my existing test cases to fail. I have merged a PR here: #249 which now gates it behind a I am lukewarm on the idea of making this "check_conditions" logic to be the default behavior. If we were to do it, it would need to (a) be done in a major release, i.e. 5.0.0, and (b) we would have to handle it very carefully. Read this comment for details: |
|
Agreed @johnnyshields I think a 5.0 with default behavior makes sense. |
This PR adds support for testing validators which are triggered only under a certain condition. The change supports if/unless options with symbol or lambda parameters as the conditions.