# Validates\_uniqueness\_of and MySQL enum type

**URL:** <https://www.ruby-forum.com/t/validates-uniqueness-of-and-mysql-enum-type/171112>\
**Category:** Rails\
**Created:** [June 26, 2009, 3:52pm UTC](https://www.ruby-forum.com/t/validates-uniqueness-of-and-mysql-enum-type/171112 "2009-06-26T15:52:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hayafirst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/13edae/32.png) [@hayafirst](https://www.ruby-forum.com/u/hayafirst)\
**Post date:** [June 26, 2009, 3:52pm UTC](https://www.ruby-forum.com/t/validates-uniqueness-of-and-mysql-enum-type/171112/1 "2009-06-26T15:52:05Z")

</div>

I tried to check validates\_uniqueness\_of for a MySql enum type column  
with a scope given, like this:

validates\_uniqueness\_of :phone\_type, :scope =\> :user\_id

And It didn’t work. When I check the SQL statement for doing this  
validation, it is like this:

SELECT `phone_numbers`.id FROM `phone_numbers` WHERE  
(`phone_numbers`.`phone_type` = BINARY ‘’ AND `phone_numbers`.user\_id  
= 23) LIMIT 1

phone\_type was set to be “Home”. If I try validates\_uniqueness\_of on  
any other columns. it works fine. Could some please highlight me  
what’s going on? Thanks
