Hey!

I think it'd be helpful if you provide us with a little bit of context.
What are you trying to achieve?

Basically, you have two lines of defense: the app and the database. Like
Colin said, if uniqueness is an essential constraint in your domain then
you should enforce it at the database level. You can also use Active Record
uniquness validator to display a nice error message (but this w/o the
database-level constraint is not enough). If there's a race condition
Active Record will raise RecordNotUnique.

If you tell us a bit more we might be able to give you more specific advice.

Best regards
-- 
Greg Navis
I help small tech companies to scale Heroku-hosted Rails apps.
Free, biweekly scalability newsletter for SaaS CEOs
<http://www.gregnavis.com/newsletter/>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAA6WWt9ok_FXBbK5UomX23VT4LiLP7B%2BC0UPYF8A9PgBvrYtWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to