-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Using mongoid 2.4.12...
Not sure this is actually very common, as the docs for ActiveRecords callbacks don't really talk about it at length, but they have one example at the top of the page showing this syntax:
before_validation(:on => :create) do
- callback goes here
end
Which indicates that this should be run before the model gets validated when it is being created. I tried this, and after some testing it appears as though the callback gets fired any time the document is being validated (regardless of whether it's being created or not).
Not a huge deal, but itt would be nice if we could use the syntax above, unless this is something that ActiveRecod doesn't truly support other than that one scenario (before_validation(:on => :create)), in which case it may not be worth the effort.