> I've come across the need in my project to use DataMapper contextual > validations to group different validations for different stages of > data collection. I'm running into some major issues however. The way I > understood from the wiki documentation, when I define a validation > without a :when clause, it should apply globally, right?
My understanding from the wikki is that where you don't supply a context the validation is added to a context called :default. Validations will only be run in this context if you either specify the :default context or if you don't supply a context - i.e. it isn't a global context it is an actual context just like any explicit contexts you define. This means that if you want a validation to run in more than one context you need to explicitly specify all the contexts you want it to run under (so if you want a global context then you'll need to include all your contexts in it's :when clause). I haven't dug through the contextual validation code but I have used it and this is how it seems to behave. hth Rupert --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
