[aida] URL duplicates (was Tutorial bug with preferedUrl?)

Janko Mivšek janko.mivsek at eranova.si
Fri Jan 27 17:34:00 CET 2012

S, Robert Calco piše:
> I have implemented the Aida tutorial but notice a quirk when adding new
> entries, namely, the URL of the new object is always "-c". For example,
> if you add 'Jack', 'Beanstalk', '1234567890', 'jack na beanstalk.com
> <mailto:jack na beanstalk.com>', the URL of the new entity is
> '/address/-c'. It seems to me it should generate correctly the URL
> '/address/beanstalk' instead.

This is how duplicates of URLs are resolved. If you see '-a', '-b', '-c'
etc, in URLs, then you certainly have an URL duplicate situation.

URL duplicate situation arises when two or more objects suggest the same
URL by their #preferedUrl method.

When an address is created (by an App), we don't know name and surname
yet, but Aida already needs his URL. So his #preferedUrl returns
'/address/'. and because the previous one already registered this URL,
Aida resolvs the duplicate by registering '/address/-a'.

> In order to fix the situation I have to run
> book addresses do: [ :each | URLResolver default changeToPreferedURL:
> each ].

Another possibility is to change new person URL after adding it to the
address book, because at that point name and surname is entered.

I just updated the tutorial adding and explaining changeToPreferedURL:
for this case.

> ... (fortunately I have the 'book' reference in my transcript which I
> don't dare lose). Then everybody's URL is right.
> - Bob
> _______________________________________________
> Aida mailing list
> Aida na aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida

Janko Mivšek
Smalltalk Web Application Server

More information about the Aida mailing list