/**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate()
 {
     $model = new Follow();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $flag = 0;
     if (isset($_POST['product_id'], $_POST['follow_flag'])) {
         $model = $model->loadFollowModel($_POST['product_id']);
         //$model->attributes=$_POST['Wishlist'];
         if ($model == null) {
             $model = new Follow();
             $model->setIsNewRecord(TRUE);
         }
         //                echo "</pre>";                            echo "post"; //var_dump($model);
         //                die();
         $model->follow_flag = $_POST['follow_flag'] ? 0 : 1;
         $model->product_id = $_POST['product_id'];
         // echo "</pre>";                            echo "post"; var_dump($model); die();
         if ($model->save()) {
             echo "saved";
             //     echo "</pre>";                            echo "post"; var_dump($model); die();
             //$this->redirect(array('view','id'=>$model->follow_id));
         } else {
             var_dump($model->getErrors());
         }
     }
     $this->render('update', array('model' => $model, 'productId' => $model->product_id, 'follow_flag' => $flag));
 }