I suspect that Phaedo--like myself--has a flash() method in
AppController that runs the redirect. Note the second param given.

I see a few things not quite right with the example. Are you certain
that the databas is being updated? There's no version given but, if
using 1.2:

$this->Sorrow->id = $id;
This is superfluous. Better to just use read().

if (empty($this->data)) {
     $this->set('sorrow', $this->Sorrow->read());
     $this->data = $this->Sorrow->read();
Speaking of unnecessary, why do this twice? What are you doing in the
view with $sorrow that can't be done with the anonymous (and, perhaps,
less glamorous ;-) data array?

Anyway, it should be $this->Sorrow->read(null, $id);

} else {
    if ($this->Sorrow->save($this->data['Sorrow'])) {

That should be "...save($this->data)", AFAICT.

        $this->flash('Your post has been updated.','/sorrows');

Difficult to say without seeing your flash() method.


On Wed, May 21, 2008 at 9:34 PM, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> $this->redirect('name_of_action_you_are_redirecting_to');
>
> Boom-shacka-lacka-boom.
> -Joel.
>
> On May 21, 9:00 pm, phaedo5 <[EMAIL PROTECTED]> wrote:
>> I have this Edit view in my controller.
>>
>>         function edit($id = null) {
>>                 $this->Sorrow->id = $id;
>>                 if (empty($this->data)) {
>>                         $this->set('sorrow', $this->Sorrow->read());
>>                         $this->data = $this->Sorrow->read();
>>                 } else {
>>                         if ($this->Sorrow->save($this->data['Sorrow'])) {
>>                                 $this->flash('Your post has been 
>> updated.','/sorrows');
>>                         }
>>                 }
>>         }
>>
>> I was hoping that it would update the database, which it does, and
>> then redirect to the index view.  Am I missing something?  Obviously I
>> am, the question is - what am I missing?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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