title: Ruby on Rails: Query rails model for a specific precision on a floating point attribute
body: <p>In my Rails application, I have a table of <strong>Places</strong> that is structured like this.</p>
  
  <pre><code>id &lt;int&gt;
  name &lt;string&gt;
  longitude float
  latitude float
  </code></pre>
  
  <p>Problem is, we did not enforce any precision/scale standards on our latitude/longitude attributes. Hence, some Places may have each/both of their longitude &amp; latitude to be greater/lesser than 6 decimal places.</p>
  
  <p>I want to find all my Places that have been saved with a specific precision of latitude/longitude. Something like this: </p>
  
  <ul>
  <li>Get all places with longitude of 5 decimal places</li>
  <li>Get all places with latitude of 7 decimal places</li>
  <li>Get all places with longitude of 4 decimal places &amp; latitude of 8 decimal places</li>
  <li>Etc</li>
  </ul>
  
  <p>Can anyone suggest how to perform such a query using Rails active records? </p>
  
  <p>P.S. I am using PostgreSQL v9.4.14</p>