Hello!
I have an empty magma database (I'm using Keithy's ToDo tutorial application with Magma seasideHelper). This one: http://wiki.squeak.org/squeak/6021 So please get the latest version (7) so you can answer on my question :)
In the StMagmaDatabase->#createDefaultUser (which is temporary called from #findUserByEmail) I'm initializing a database and adding one user with ' todo@todo.tut' email:
| user |
self initialize.
user := StUser new. user id: 1. user email: 'todo@todo.tut'. user userName: 'todo'. user password: 'todo'. self addUser: user.
then I'm trying to find user by email ('todo@todo.tz'). BUT... I'm getting a wrong result
user := self users where: [:each | each read: #email at: 'todo.tz'. ].
user first explore.
user first returns the first user in MagmaCollection with the WRONG email ('todo@todo.tz').
So how can I get nil in this case? (because there is no user with such email in database). Thanks.
Oleg Korsak a écrit :
Hello!
I have an empty magma database (I'm using Keithy's ToDo tutorial application with Magma seasideHelper). This one: http://wiki.squeak.org/squeak/6021 So please get the latest version (7) so you can answer on my question :)
In the StMagmaDatabase->#createDefaultUser (which is temporary called from #findUserByEmail) I'm initializing a database and adding one user with 'todo@todo.tut mailto:todo@todo.tut' email:
| user | self initialize. user := StUser new. user id: 1. user email: 'todo@todo.tut <mailto:todo@todo.tut>'. user userName: 'todo'. user password: 'todo'. self addUser: user.
then I'm trying to find user by email ('todo@todo.tz mailto:todo@todo.tz'). BUT... I'm getting a wrong result
user := self users where: [:each | each read: #email at: 'todo.tz <http://todo.tz>'. ].
I am wondering, does your where query should look like:
user := self users where: [:each | each email includesAllOf: 'todo.tz'].
Of course, you should have an index on the email attribute, and the addUser: method should do a commit behind the scene. But I guess this is what is doing seaside helper.
Hilaire
magma@lists.squeakfoundation.org