Monday, July 30, 2012

Re: HABTM association: How to populate ONLY the joining table

i actually have the same issue but how can i put it in view when if i edit my user profile? i have Users and UserProfile table

On Sunday, August 8, 2010 10:16:16 PM UTC+8, Mariano C. wrote:
I have books and users table. Both tables have id field as PK, and
both have respective Book and User model and controllers.

There's a third table called books_users, this table have an id field
as PK and two FK called user_id and book_id.

There's a lot of books in the books table, and logged in user can
choice to add a book to his collection, to do this is necessary to add
a row on books_users table with choosen book's id and logged in user's
id.

Actually I do this through a function add() in the controller
BooksUsersController and relative view and model (BookUser).
There's a smarter way to do this.

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

No comments: