Sweet! Thanks for the tips, I think you're right, gonna do a lot of reading on associations before I get back to coding and create more work for myself than I need to ;-)
On Saturday, June 2, 2012 3:23:40 AM UTC-5, stork wrote: > > > when a new blog is created... I know it's probably wrong to do so, but it >> is easier for me to.... > > > You're right - it is wrong. Although it is technically possible, it would > cause many side effects you would have to solve in app code. Follow cake > conventions and cake will help you to do what you want behind the scene. > Don't fight cake as a newbie, let it help you :-) > > Besides, from the architectural point of view, "is this user authorized to > call this action" should be decided before action is called, it is work for > isAuthorized() callback, for example see how it is done here: > > http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html#authorization-who-s-allowed-to-access-what > > In your case, where BlogPost belongsTo Blog belongsTo User, your custom > method BlogPost::isOwnedBy() would test Blog.user_id - you _can_ set > conditions for "parent" model record associated as belongsTo, therefore > adding field user_id to blog_posts table is not necessary. > > Sorry if I've wasted your time with newbie issues :-P >> > > No need to be sorry, this is right place to ask questions. Well, one of > them ;-) http://ask.cakephp.org/ > > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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