# Validates\_uniquenes\_of with decimal columns and mysql

**URL:** <https://www.ruby-forum.com/t/validates-uniquenes-of-with-decimal-columns-and-mysql/178872>\
**Category:** Rails\
**Created:** [November 12, 2009, 7:59pm UTC](https://www.ruby-forum.com/t/validates-uniquenes-of-with-decimal-columns-and-mysql/178872 "2009-11-12T19:59:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddy\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8e7dd6/32.png) [@Eddy\_J](https://www.ruby-forum.com/u/Eddy_J)\
**Post date:** [November 12, 2009, 7:59pm UTC](https://www.ruby-forum.com/t/validates-uniquenes-of-with-decimal-columns-and-mysql/178872/1 "2009-11-12T19:59:05Z")

</div>

I’m using this validation in my model:

validates\_uniqueness\_of :zoom\_level,  
:scope =\> [:latitude, :longitude]

:latitude and :longitude are decimal columns in a mysql database. It  
isn’t working. I’ve searched in Google and I found that there were an  
error with MySQL but it’s supposed to be fixed.

I’m using Rails 2.3.4. Is there a Rails solution to this problem or  
the only solution is creating unique indexes in the database?
