I have the following rules:
public function rules()
{
return [
[['title', 'course_topic_id'], 'required', 'on' => 'create'],
[['title', 'course_topic_id', 'active'], 'required', 'on' => 'update'],
[['title', 'description'], 'string'],
[['course_topic_id', 'active'], 'integer'],
['active', 'default' => 1],
[['date_added'], 'safe']
];
}
When someone creates a new question record I am trying to set the ‘active’ field using the default rule. But I get Invalid validation rule: a rule must specify both attribute names and validator type.