Manually Add Attribute to Existing Model

before this i usually searching solved question for my problem, but finally a cannot find it.

than i decide to create account in this yii forum, and this my first post :)

in my case, i have built a model active record, but unpredictably i should add a new attribute to my existing model. so i add new attribute in my database, my new attribute name is "type". the problem is when i put an array value into "$model->attributes", the value of my new attribute "type" is not included. my solution is put a value to $model->type variable. although the problem is solved, i believe my solution is not the best way. so i hope you can help me to understand the best way to edit model in yii.

sorry for my bad english :P

Make sure that you add a rule for the type field in rules() method .

Also you can activate CWebLogRoute to see if you have any errors.

following your suggestion, i add my "type" attribute on "safe" validator and it works like a charm!!!

thanks Tofan Andrei :D