AR -> on insert rule


I am trying to set fields required when inserting a new record like that:

array('image_thumb, image, image_medium, id_theme', 'required','on'=>'insert'),

But it doesn't work, when I click on create and if all fields are empty, the record is created.

Is there a better way to do that?

Thank you.

Can you paste the entire rules() ?

Also, does it work when you just create the object like


Here the entire rules :

And I am calling the right way, $obj=new record();


Did you set $model->scenario ?

Thank you Qiang, i called :

And it works.