Thanks for the replies. I'm also not sure if doing the validation in the model would work. Assuming that the user has a slow connection and hits submit on the form twice, then the first time the email would be unique, so everything would be good. However, would it not be the case that the second time the user presses submit, the record would have been stored, but the success screen would have not been displayed (hence them feeling the need to press submit a second time). In this case the email address would no longer be unique and an error would be thrown. So, potentially the user could think that their data had not been submitted, when in fact what they would be seeing was an error caused by their second submission (their first having been successful).
Nonetheless, thank you very much for the link Aldric. It is definitely useful to understand what is happening behind the scenes in Active Record, and it elaborates on the race conditions Fred mentioned. I will have a play around with validates_uniqueness_of this evening. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---