title: Find all records of a certain type in Polymorphic table using ActiveRecord in Rails 3
body: <p>I have a table Category that is a polymorphic model for a bunch of other models. For instance</p>
  
  <blockquote>
    <p>model Address has shipping, billing,
    home, work category</p>
    
    <p>model Phone has home, mobile, work,
    fax category</p>
    
    <p>model Product has medical, it
    equipment, automotive, aerospace, etc
    categories.</p>
  </blockquote>
  
  <p>What I want to be able to do is something like</p>
  
  <p>Product.all_categories and get and array of all categories that are specific to this model.</p>
  
  <p>Of course I can do something like this for each model in question:</p>
  
  <pre><code>Category.select("name").where("categorizable_type = ?","address")
  </code></pre>
  
  <p>Also pace_car - which is rails 3 ready, allows me to do something like this:</p>
  
  <pre><code>Category.for_category_type(Address)
  </code></pre>
  
  <p>But I was wondering if there is a more straightforward / elegant solution to this problem using Active Record iteself - without relying on a gem?</p>
  
  <p>Thank you</p>