Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  Troubles with erlyweb_magic

Guest
Posted: Mon Sep 03, 2007 1:55 pm Reply with quote
Guest
I'm trying to create my first Erlyweb application. I've created the app,
discovered that I can't have a model named "user" (else I get the complaint
about a sticky dir), and compiled everything after calling erlydb:start/2.

I'm running erlyweb-0.6.2.

When I try to go to the URL for one of my controllers called "family", it
complains that family:index/1 is not defined. In family_controller.erl,
I see "-erlyweb_magic(erlyweb)." Doesn't that define index/1, list/1, and
other methods?

If I try changing "-erlyweb_magic(erlyweb)." to "-erlyweb_magic(on)." then go
to /appname/family I am redirected to /appname//family/lib/1 (note the two
slashes) and I see a complaint that family_view:list/ is not defined. The
prettyprint in the error output shows a bunch of arguments to that method that
looks like [{"/fll/", "family", [<<"id">>, <<"name">>, <<"guid">>,
<<"active">>, <<"created_at">>].

Why doesn't "-erlyweb_magic(erlyweb)." work? What I have I forgotten to do?
I've reviewed what documentation I can find, and have not yet figured out what
I'm doing wrong.

Thank you for any pointers to documentation or hints.

Jim
--
Jim Menard, jimm@io.com, jim.menard@gmail.com
http://www.io.com/~jimm/

--~--~---------~--~----~------------~-------~--~----~
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: Mon Sep 03, 2007 5:35 pm Reply with quote
Guest
Are you sure you're using erlyweb-0.6.2? The code it should generate
when you call 'erlyweb:create_component("family", "/path/to/app")."
is:

family_controller.erl:

-module(family_controller).
-erlyweb_magic(erlyweb_controller).

family_view.erl:

-module(family_view).
-erlyweb_magic(erlyweb_view).

Note that erlyweb_magic tells erlyweb to use the given module as the
"base" module during compilation. This causes ErlyWeb to add a bunch
of functions defined in the base module to your child module.

If you have the latest version of ErlyWeb, there must be a bug
somewhere that I'm not seeing because it generates the right code for
me. Still, if you modify your erlyweb_magic declarations to use
erlyweb_controller and/or erlyweb_view instead of just 'erlyweb'
things should work.

Let me know how it goes.

Cheers,
Yariv

On 9/3/07, Jim Menard <jim.menard@gmail.com> wrote:
>
> I'm trying to create my first Erlyweb application. I've created the app,
> discovered that I can't have a model named "user" (else I get the complaint
> about a sticky dir), and compiled everything after calling erlydb:start/2.
>
> I'm running erlyweb-0.6.2.
>
> When I try to go to the URL for one of my controllers called "family", it
> complains that family:index/1 is not defined. In family_controller.erl,
> I see "-erlyweb_magic(erlyweb)." Doesn't that define index/1, list/1, and
> other methods?
>
> If I try changing "-erlyweb_magic(erlyweb)." to "-erlyweb_magic(on)." then go
> to /appname/family I am redirected to /appname//family/lib/1 (note the two
> slashes) and I see a complaint that family_view:list/ is not defined. The
> prettyprint in the error output shows a bunch of arguments to that method that
> looks like [{"/fll/", "family", [<<"id">>, <<"name">>, <<"guid">>,
> <<"active">>, <<"created_at">>].
>
> Why doesn't "-erlyweb_magic(erlyweb)." work? What I have I forgotten to do?
> I've reviewed what documentation I can find, and have not yet figured out what
> I'm doing wrong.
>
> Thank you for any pointers to documentation or hints.
>
> Jim
> --
> Jim Menard, jimm@io.com, jim.menard@gmail.com
> http://www.io.com/~jimm/
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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: Mon Sep 03, 2007 9:36 pm Reply with quote
Guest
Yariv,

On 9/3/07, Yariv Sadan <yarivsadan@gmail.com> wrote:
>
> Are you sure you're using erlyweb-0.6.2? The code it should generate
> when you call 'erlyweb:create_component("family", "/path/to/app")."
> is:
[snip]

That was the clue I needed. I had originally generated the code with
0.6, and then upgraded to 0.6.2 sometime during my exploration. After
regenerating everything using 0.6.2 from start to finish, it all works
perfectly.

Thank you for your help.

Jim
--
Jim Menard, jimm@io.com, jim.menard@gmail.com
http://www.io.com/~jimm/

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

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