-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
According http://mongoid.org/en/mongoid/docs/validation.html you can do something like
validates :foo, presence: true, on: :create validates :bar, presence: true, on: :update
what is in consistence with the behaviour of active record. But in my case (mongoid-4.0.1) it failed. After fiddling around I found out that it works with strings.
validates :foo, presence: true, on: 'create' validates :bar, presence: true, on: 'update'
So in my honest opinion, I state this as a minor bug. When I have time, I'll fix it but in the mean this ticket should be a hint for other users stepping in this trap.