Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  More questions :)

dmitriid
Posted: Mon Jan 21, 2008 11:55 am Reply with quote
User Joined: 17 Aug 2006 Posts: 213
> 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}]}

Sad


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message
Guest
Posted: Wed Jan 23, 2008 7:06 am Reply with quote
Guest
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 <dmitriid@gmail.com> 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}]}
>
> Sad
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Wed Jan 23, 2008 7:07 am Reply with quote
Guest
...or you can call page:page_sections(hd(Pages)).

On Jan 22, 2008 11:05 PM, Yariv Sadan <yarivsadan@gmail.com> 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 <dmitriid@gmail.com> 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}]}
> >
> > Sad
> >
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
dmitriid
Posted: Wed Jan 23, 2008 7:53 am Reply with quote
User Joined: 17 Aug 2006 Posts: 213
Yariv Sadan wrote:
> ...or you can call page:page_sections(hd(Pages)).
>
It works! Thanks! Smile

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum