Saturday, July 4, 2009

Re: Automagically filling table-fields?

Hi,

should be Post not Posts:

$this->data['Post']['username'] = $this->Auth->user('username');

Regards,
Hendry

On Sun, Jul 5, 2009 at 2:58 AM, eMilk<emil.kjaehr@gmail.com> wrote:
> This is my PostsController::add():
>        function add() {
>                        if (!empty($this->data)) {
>                                $this->data['Posts']['username'] = $this->Auth->user
> ('username');
>                        if  ($this->Post->save($this->data)) {
>                                $this->Session->setFlash('Your robot has been saved.');
>                                $this->redirect(array('action' => 'index'));
>                        }
>                }
>        }

--~--~---------~--~----~------------~-------~--~----~
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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: