I created a table ‘userfacility’ which comprise fields status, last_name,userid, facilityid, created. I made facilityid and last_name as mandatory in the model (array(‘facilityid,last_name’, ‘required’)).
Then I tried to save a record for ‘userfacility’ through other controller by.
After $model->save();
if ($_POST['User']['facility_id'] >0)
{
$update_facility = new UserFacility('udf');
$update_facility->userid = $model->id;
$update_facility->facilityid = $model->facility_id;
$update_facility->save();
}
For this I created a rule with scenario in the ‘userfacility’ model. Like this
array(‘userid, facilityid’, ‘required’,‘on’=>‘udf’),
But it doesn’t work it still looks for the old rule with last_name and facility_id. I don’t understand why?