I'm building an app that does most of its work via AJAX, so I don't
think the form-based methods for working with associations in the docs
will work, and I can't figure out how to update and create
hasAndBelongsToMany relationships from a controller.

What I have is basically a posts table, a tags, table, and a posts_tags
table as expected. The HABTM relationship works perfectly for
retrieving data: When I retrieve posts I get the tags along with them.
But saving is another matter. I've tried passing various permutations
of the following array to Post->save():

Array
(
    [Post] => Array
        (
            [name] => postname
            [id] => 138
        )

    [Tag] => Array
        (
            [0] => Array
                (
                    [name] => test tag
                )

        )
)

...which I would expect to save a relationship between post #138 and
the tag named "test tag", creating the tag if necessary. Is that
possible? If so, what am I doing wrong?


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

Reply via email to