Yii set default value in model rules

The yii default rule only works if there is no database default value set for the field. Therefore you should either set the default in DB or in Model rules like

   array('active','default', 'value'=> 1, 'setOnEmpty'=>TRUE),

Leave a Reply

Your email address will not be published. Required fields are marked *