title: Get route for base class of STI class in Rails
body: <p>Say I have a rails app with 3 models, Person, Place and Thing.  Say the Thing uses single table inheritance, so there are FancyThing and ScaryThing subclasses.  Then there are routes defined with <code>map.resources :people, :places, :things</code>.  So there are no controllers for FancyThings and ScaryThings, the ThingsController handles either type.  </p>
  
  <p>Now say I need to have code that shows a list of anything has links to them.  If I have this code in my view:</p>
  
  <pre><code>&lt;% @items.each do |item| %&gt;
    &lt;%= link_to item.name, item %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>If item is a Person or a Place, this works fine, <code>polymorphic_path</code> takes care of generating the correct route.  But if item is a FancyThing or a ScaryThing, this blows up, because it will try to use <code>fancy_thing_path</code>, which there is no route for.  I want to somehow make it use <code>thing_path</code>.  Ideally there would be a method on Thing and/or its subclasses that somehow indicates the subclasses should use the base class to generate the route.  Is there an elegant solution to this?</p>