Good insight! I'm implementing something similar too (I'm inserting data to an XML node instead of DB)... good thing I've read your comment.
[ simon.cpu ] On Wed, Jun 24, 2009 at 8:15 PM, Felix Gilcher <[email protected]> wrote: > > Both of you, don't forget that there is a race-condition. Your validator > tests only that the name is unique at the exact moment when you validate it. > It might be taken a millisecond after that, before you insert in in the > database. So you should still place a unique constraint on that database > field and catch any resulting errors. > > cheers > > felix > > > On Jun 24, 2009, at 2:07 PM, Benjamin Börngen-Schmidt wrote: > >> Hey there, i have used a custom validator in Redracer and I think this >> is the best solution. If you find something better please let me know. >> >> Am 24.06.2009 um 12:45 schrieb Michal Charemza >> <[email protected]>: >> >>> I would like to validate a field to be unique in a database: >>> essentially to give the user a 'this name already taken' message. I >>> wonder what's the best way of going around this: writing a custom >>> validator that accesses a model, or is there another better way? >>> >>> Michal. >>> >>> _______________________________________________ >>> users mailing list >>> [email protected] >>> http://lists.agavi.org/mailman/listinfo/users >> >> _______________________________________________ >> users mailing list >> [email protected] >> http://lists.agavi.org/mailman/listinfo/users >> > > -- > Felix Gilcher > > Bitextender GmbH > Paul-Heyse-Str. 6 > D-80336 München > > T: +49 89 57 08 15 16 > F: +49 89 57 08 15 17 > M: +49 172 840 88 28 > > [email protected] > http://bitextender.com/ > > Amtsgericht München, HRB 174280 > Geschäftsführer: David Zülke, Florian Clever > > _______________________________________________ > users mailing list > [email protected] > http://lists.agavi.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
