Hi all,

I have an issue that I would've thought is very common but after much
searching around I cannot find information on it.  I am trying to
figure out how to add and remove associations between two model
records in a HABTM relationship where the model records already exist
and aren't changing.  All the information I can find only talks about
saving new model records with related data but not how to simply
change associations between existing records.

Example:

Group <-- HABTM --> Permission

Let's say I have a Group record with id = 1 and a Permission record
with id = 5.

How do I add a record with (group_id = 1, permission_id = 5) to the
groups_permissions table from within PermissionsController?

I've tried doing this in a few ways but even if I don't get an error
when the script runs, records are not actually added/removed from the
database table.  Do you have to tell Cake to add/remove associations
like this manually or are you supposed to do it by somehow updating
the parent model record and having Cake make the changes
automatically?  I'm really lost on this conceptually.

I have found this question asked in a couple other places but it is
never answered.  Here is another thread that seems to be asking the
same question:

http://groups.google.com/group/cake-php/browse_thread/thread/9dff77d7965cf8dc/1feea73bdb09e0a1?lnk=gst&q=habtm+join+tables#1feea73bdb09e0a1

Thanks in advance!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to