Ok, sorry, didn't see you were using the $this->data variable later
inside the if statement, so please move the statement:

$this->data = $this->Comment->create();

after your find statement. The find statement uses the data from the
$this->data variable!

Tell us if the above fixes your problem, or what Chickenhen wrote did!
Enjoy,
   John

On Dec 7, 10:00 pm, Andrei BOGDAN <[email protected]>
wrote:
> I've change my code and the add action from comments controller looks like 
> this:
> [code]  
> function add() {
>                 if (!empty($this->data)) {
>                  if ($this->Comment->save($this->data)) {
>                   $this->data = $this->Comment->create();
>                         $comments = $this->Comment->find('all', 
> array('conditions' =>
> array('post_id' => $this->data['Comment']['post_id']), 'recursive' =>
> -1));
>                         $this->set(compact('comments'));
>                         $this->render('add_succes','ajax');
>                         } else { $his->render('add_failure','ajax');}
>                 }
>         }
> [/code]
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to