Best way to disable a specific validation rule
I have a certain validation rule that I don't want to apply in one
particular cirumstance.
The rule is based on allowing a user to create something, if they are
the 'owner' of an assoicated model.
The rule works fine most of the time, but I want to override it for a
certain usertype. This user type has its own set of actions defined by
routes.
So, to disable the particular rule, I am doing this, in the action
'usertype_add'
unset($this->Model->validate['other_model_id']['userOwnsModel']);
Where userOwnsModel is a custom validation rule I have setup in the
model.
This seems to work fine, but feels a bit 'hacky'.
Is this an accepted soution in cakePHP, or are there any better ways
to handle this?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home