tags:

views:

268

answers:

2

hello,

I have a CActiveRecord model, and I need to change safe attributes list in that model. I have defined the safeAttributes method inside my model, like the following :

public function safeAttributes()
{
    return array(
    'name, bio',
    );
}

the problem is 'bio' is not being considered in my safe attribute assign. I tried to dump the model safeAttributeNames attribute in my model, and what I've got was completely different from what safeAttributes should return.

Am I doing this in the right way ?

cheers, Firas

+1  A: 

Assuming that you are using Yii 1.0.x then that is the correct way to do it.

If you are using Yii 1.1.x then it's changed. Have another read of the documentation.

public function rules()
{
    return array(
        array('username, password', 'required'),
        array('rememberMe', 'boolean'),
        array('password', 'authenticate'),
        array('something', 'safe'),
        array('someOtherThing', 'unsafe'),
    );
}
Blair McMillan
A: 

nj koa002-ç;-dp - da -r -t -da -f -pqp -v -s -f -a -l -l

Rasmus