Perceptes, unless I am misunderstanding you, this is very easy to solve. Make sure your models have the right relationships. Create an edit action and view for the group model. In that edit view, for the groups model, add a multiple select list using the permissions model. You of course need to set a variable in the controller, but HABTM is documented quite well in the manual. Then view the page, and select or unselect the appropriate permissions. The relationship table will be updated accordingly.
This is CakePHP 101, and like I mentioned, is all in the manual. http://book.cakephp.org/view/312/Models ' EW On Oct 23, 5:56 am, Perceptes <[EMAIL PROTECTED]> wrote: > 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/9dff77d7... > > 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 -~----------~----~----~----~------~----~------~--~---
