You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A model should be able to add a conditional validation to a key defined in a parent model, even if it uses its own collection. This was working in mongomapper 0.11.1 but it doesn't work in master currently. Instead the conditional on the validation is apparently ignored, i.e. the validation is applied when it shouldn't be.
Here's a test case:
# add this to spec/functional/validations_spec.rbcontext"conditional validation"doit"should do conditional validation in child classes"doparent_class=Docdokey:name,StringendclassChildDoc < parent_classvalidate:never_valid,:if=>lambda{false}set_collection_name'anything'defnever_validerrors.add(:name,'not valid, sorry')endendChildDoc.new.shouldbe_validendend
The text was updated successfully, but these errors were encountered:
A model should be able to add a conditional validation to a key defined in a parent model, even if it uses its own collection. This was working in mongomapper 0.11.1 but it doesn't work in master currently. Instead the conditional on the validation is apparently ignored, i.e. the validation is applied when it shouldn't be.
Here's a test case:
The text was updated successfully, but these errors were encountered: