Thank you for your help.
Now I have another problem :
buildEditorFor: anItem
^(anItem description copy
addCondition: [:memento | (Item repository
contains: [:each | memento model id = each not]) not]
labelled: 'An item with that id already exists';
asComponentOn: anItem)
addValidatedForm;
yourself
The memento model id doesn't change it's value when I edit
it. I saw MACheckedMemento has a #cache and a #original
method, maybe I should use them, but I don't know how.
Sebastien
That's because the memento doesn't write to the model until after it passes
all its validations. You need to check the pending values, which are in the
memento keyed by your descriptions. You don't want to say "memento model
id" in your rule, you want to say "memento cache at: YouModel
descriptionId"
to see it's pending value.
Ramon Leon
http://onsmalltalk.com