Defaultvaluevalidator And On Insert Scenario Not Working

I have the following rule in my model:


public function rules()

{

    return [

        [['ip'], 'default', 'value' => $_SERVER['REMOTE_ADDR'], 'on' => 'insert'],

    ];

}

However, it does not work. IP address is not inserted when I create a new model. Any idea what could be wrong?