Validates_uniqueness_of not working - urgent

I’m using restful_authentication to let users register and login.
Lately, however, I’m seeing multiple login and emails being created
even though I have validates_uniqueness_of as below:

user.rb
validates_uniqueness_of :login, :email, :case_sensitive => false

mysql> select id, login, email, created_at, state from users;
±—±--------------±---------------------------
±--------------------±--------+
| id | login | email |
created_at | state |
±—±--------------±---------------------------
±--------------------±--------+
| 1 | sthapit | [email protected] | 2008-02-08
06:15:00 | active |
.
.
.
| 34 | changed1 | [email protected] | 2008-07-20
06:35:35 | pending |
| 35 | changed1 | [email protected] | 2008-07-20
06:35:40 | active |
| 38 | changed2 | [email protected] | 2008-08-15
11:40:38 | pending |
| 39 | changed2 | [email protected] | 2008-08-15
11:40:43 | pending |
.
.
±—±--------------±---------------------------
±--------------------±--------+

If anyone has an idea why this is happening it would be very
appreciated. (login and emails changed in the table above, but id,
created_at, and state are accurate).

On 21 Aug 2008, at 19:05, vince [email protected] wrote:

I’m using restful_authentication to let users register and login.
Lately, however, I’m seeing multiple login and emails being created
even though I have validates_uniqueness_of as below:

Have you checked they don’t differ only by a space or something? Other
than that validates_uniqueness_of is vulnerable to race conditions. If
you want a 100% reliable enforcement of this, use a unique index.

user.rb
validates_uniqueness_of :login, :email, :case_sensitive => false