Hello everyone, I'm having trouble with the authentication system, the scenario is as follows: I have a database with two tables (Users and Posts) Posts in have a user-id field.
My PostsController.php with add () function <?php class PostsController extends AppController { public $uses = 'Post'; public $name = 'Posts'; public function index() { $this->set('posts', $this->Post->find('all')); } public function adicionar() { if($this->request->is('post')) { if($this->Post->saveAll($this->request->data)) { $this->Session->setFlash('O post foi adicionado com sucesso!'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash('O post não foi adicionado. Tente novamente!'); } } } And adicionar.ctp <div class="users form"> <?php echo $this->Form->create('Post'); ?> <fieldset> <legend>Adicionar</legend> <?php echo $this->Form->input('title'); echo $this->Form->input('body'); ?> </fieldset> <?php echo $this->Form->end('CRIAR POST'); ?> </div> <div class="actions"> <h3>Actions</h3> <ul> <li><?php echo $this->Html->link('Listar', array('action' => 'index')); ?></li> </ul> </div> The problem is that the bank is not slavando logged the user who created the post, tried using the hasOne model but had no luck. Can you help me? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.