Hi. If I got it right, then I don't see any problem :)

As I understood the concept of subforums, any forum can have some
number of subforums, but is it really case one subforum may be placed
in more them one forum? Do we really need many-to-many relation?

On 7/7/09, Takayoshi Kyou <[email protected]> wrote:
>
> Hi all,
>
> I am trying to make a forum application that every forum can have
> their
> child-forums. But I found it hard to represent these with erlydb.
>
> First I tried to use a self-referencing many-to-many relation:
>
> new (A) ->
>     Post_data = yaws_api:parse_post(A),
>     {value, {parent_forum_id, Parent_forum_id_str}, Other_fields} =
>       lists:keytake(parent_forum_id, 1,
>                     %% convert every keys from string to atom
>                     [ {list_to_atom(K), V} || {K, V} <- Post_data ]),
>     New_forum = forum:save(forum:new_with(Other_fields)),
>     Parent_forum_id = list_to_integer(Parent_forum_id_str),
>     %% A negative parent ID means it is an orphan.
>     if Parent_forum_id > 0 ->
>           forum:add_forum( forum:find_id(Parent_forum_id), New_forum );
>        true ->
>           ok
>     end,
>     {ewr, forum, index}.
>
>
> But this isn't work because the relation between parent and child is
> "two-way"
> that I can't detect who is the parent and who are the childern when I
> use
> forum:forums to access it.
>
> Any idea?
>
>
> Thanks
> >
>


-- 
With Best Regards,
Alexander Dergachev

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"erlyweb" 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/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to