title: How do you handle type/code columns (non-STI) with AR?
body: <p>I was discussing this pattern with a colleague and everyone seems to have their own take ont this. Thought using a type/code attribute seems to be a pretty common case, there's no standardized solution for it. I wonder what is yours?</p>
  
  <p>Say you have a non-Single Table Inheritance type/code column on a ActiveRecord model. What do you use to specify types and create accessors, scopes, etc. A hash of symbols, a hash of codes, plain constants or...?</p>
  
  <p>Something like the following:</p>
  
  <pre><code>class Listing &lt; ActiveRecord::Base
    LISTING_TYPES = {
      :sale  =&gt; 1,
      :rent  =&gt; 2,
      :lease =&gt; 3,
    }
  
    validates :listing_type, :inclusion =&gt; {:in =&gt; LISTING_TYPES.values}
  end
  </code></pre>
  
  <p>Thanks in advance.</p>