Hi Brian, Thanks - will try that out right away! :)
On Jul 4, 7:12 pm, brian <bally.z...@gmail.com> wrote: > Add a user_id column to the posts table. You should use that as your > foreign key. > > As for filling it in automatically, you can do that right before > save() in PostsController::add() > > $this->data['Posts']['user_id'] = $this->Auth->user('id'); > > On Sat, Jul 4, 2009 at 12:55 PM, eMilk<emil.kja...@gmail.com> wrote: > > > Hi all you experienced bakers. > > > I'm new to the world of CakePHP, so forgive me if this is a very basic > > question. > > I followed a few tutorials, and have a question about getting > > information filled automagically into the different fields of the > > table. > > > First off, I extended the blog tutorial with a simple implementation > > of Auth, based heavily on what I could find here: > >http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-aut... > > > Then, I've extended on the blog tutorial, and have been adding new > > fields to the "posts" table from the example. One of the new fields, I > > created is 'username'. > > > Here's the deal: I'd really like to have the 'username' field being > > filled automagically based on what user is logged in, just like it > > does to both the 'modified' and 'created' fields by default in the > > blog-tutorial. > > > From the blog-tutorial, bottom: [10.1.2 Creating the Blog Database] > > "Check out "CakePHP Conventions" for more information, but suffice it > > to say that naming our table 'posts' automatically hooks it to our > > Post model, and having fields called 'modified' and 'created' will be > > automagically managed by Cake." > > > Thanks in advance! > > Best regards, > > Emil K --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---