...or you can call page:page_sections(hd(Pages)).

On Jan 22, 2008 11:05 PM, Yariv Sadan <[EMAIL PROTECTED]> wrote:
> When you call page:find({id,'=',1}) it returns a list with one
> element, and you're not supposed to pass this list to
> page:page_sections(). What you want to do is call page:find_id(1).
>
> Yariv
>
>
> On Jan 21, 2008 3:55 AM, Dmitrii 'Mamut' Dimandt <[EMAIL PROTECTED]> wrote:
> >
> >
> > > in page_section.erl, add this function
> > >
> > > relations() ->
> > >   [{many_to_one, [page]}].
> > >
> > >
> > Tables:
> >
> > page                                 page_section
> > ---------                            --------------
> > id                                   id
> > title                                page_id
> > url_title                            section_text
> >                                      section_order
> >
> >
> > Then I added
> >
> > page.erl                             page_section.erl
> > ---------                            ----------------
> > -export([relations/0])               -export([relations/0])
> >
> > relations() ->                       relations() ->
> >  [{one_to_many, [page_section]}].      [{many_to_one, [page]}].
> >
> > Then:
> >
> > Page = page:find({id, '=', 1}),
> > Section = page:page_sections(Page).
> >
> > This results in a:
> >
> > ERROR erlang  code  crashed:
> >  File: appmod:0
> > Reason: {badarg,[{erlydb_base,get_module,1},
> >                  {erlydb_base,find_related_many_to_one,5},
> >                  {view_controller,page,2},
> >                  {erlyweb,ewc,2},
> >                  {erlyweb,handle_request,6},
> >                  {yaws_server,deliver_dyn_part,8},
> >                  {yaws_server,aloop,3},
> >                  {yaws_server,acceptor0,2}]}
> >
> > :(
> >
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
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