> > Stick a unique index on the field and you'll be fine. > > that's fine - but then validates_uniqness_of is not needed - right > now it's just there to provide users access to an easy a race > condition alongside find_or_create_by. although the answer is > simple, it simply raises questions, for me at least, about whether > those methods should even exist. my experience is that, even though > they should be, most web developers are not versed in acid. pun > intended.
No, you still need the validation otherwise instead of a "name has already been taken" validation error you get an internal server error. validates_uniqueness_of gives a nice error message, and does an ok job at guaranteeing uniqueness. Validates uniqueness of + a unique index does both. > cheers. > > > a @ http://codeforpeople.com/ > -- > we can deny everything, except that we have the possibility of being > better. simply reflect on that. > h.h. the 14th dalai lama > > > > > > > -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
