title: Ruby on Rails: How to override compare method for field in Rails Model?
body: <pre><code>class House &lt; ActiveRecord::Base
  {
      attr_acccessible :title, :address
  }
  </code></pre>
  
  <p>Values for house.title include 5, 5A, 8, 8/1, 16 etc. i.e. there is an integer prefix which primarily determines the sort order, in case they are the same I need to use the suffix ("A" or "/1" etc) etc. If I sort the title as a string, the sort order will not be right ("16" &lt; "8/1"). </p>
  
  <p>Can I override the comparison operator for this specific field? Should I be storing it as two different fields, but display the full title using the suffix if any? Prefixing 0s will still not solve the problem correctly since suffix can alter the length.</p>
  
  <p>Appreciate feedback on the right way to do it.</p>