follow The Yii Blog Tutorial step by step, when i finished Creating and Updating Posts,but cannot insert any record to the DB.
So, I creat a simple test that only one table named test, using yiic shell, crud command to generate test. In ver1.0, it generate the model and controller and _form.php that can creat,update and list. But in 1.1, it generate the files too, but when i click the button create, nothing happened.
Any one tell me why? Thanks.
Page 1 of 1
Why ver1.1 cannot insert ?
#2
Posted 14 January 2010 - 06:00 AM
In v1.1 model attributes must be declared as safe
See the guide
http://www.yiiframew...ute-assignments
<?php
public function rules() {
return array(
array('title, description', 'safe'),
);
}
?>
See the guide
http://www.yiiframew...ute-assignments
#3
Posted 14 January 2010 - 08:09 PM
Thanks for your reply. I found the reason. The command in Tutorial is 'model *' and it generate the file 'Test.php'. The class name is 'class Test extends CActiveRecord' .But when I use command 'crud test', it generate the controller using 'test' everywhere. It's case sensitive. That is the problem confuse me some days.
Share this topic:
Page 1 of 1

Help













