intro tutorial questions

0 views
Skip to first unread message

5hundy

unread,
Aug 31, 2008, 5:44:19 PM8/31/08
to erlyweb
Hi, I have 2 questions about the Introduction Tutorial.

I'm using erlyweb 0.7

1) I have problems with forming the href links. From entry_view.et, if
I leave the code as it is,
I get links like:
http://localhost:8000/entry/detail/1
instead of:
http://localhost:8000/blog/entry/detail/1

I fixed this by doing dropping the first '/' from the href link.
Unfortunately the detail pages now have really messed up links like:
http://localhost:8000/blog/category/detail/entry/detail/2

Am I doing something wrong here?

2) This is a conceptual question - could someone please explain to me
the meaning behind:

<% Entry %> (from entry_view.et)
and
<% Entries %> (from category_view.et)
and
<% Data %> (from html_container_view.et)

I don't understand what these are bound to and why. My assumption for
the 1st two is that erlyweb is doing something with the 1:many and the
many:1 relations to generate these. The plural is throwing me - does
erlyweb do pluralization expansions like rails?

jm

unread,
Aug 31, 2008, 8:13:57 PM8/31/08
to erl...@googlegroups.com
I don't have the tutorials in front of me at the moment (just warning
you in case I get this a little wrong). With the .et files you'll see a
line of the form:

<%@ detail(Entry) %>

this defines the function detail and binds Entry to the first and only
parameter passed in. Other functions can be defined in this manner.

Jeff.

5hundy

unread,
Aug 31, 2008, 9:25:41 PM8/31/08
to erlyweb
> <%@ detail(Entry) %>
>
> this defines the function detail and binds Entry to the first and only
> parameter passed in. Other functions can be defined in this manner.

Okay, yes at least the first two make sense now. I think I pretty much
understand the tutorial now.

Can anyone help me with the href issue?

Something else I've been wondering - I'm used to pluralizing table
names as the standard in Rails. Based on the tutorials and blog posts,
it seems like singular is the standard. Should I stick to that?

Yariv Sadan

unread,
Sep 1, 2008, 7:04:50 PM9/1/08
to erl...@googlegroups.com
Yes, table names are not pluralized in ErlyDB. The only pluralization
that happens is in functions that fetch many records in x-to-many
relations, e.g. if you have 'shelf' and 'book' table and a shelf has
many books the generated functions would look like 'shelf:books()'.
Reply all
Reply to author
Forward
0 new messages