# Polymorph without extra tables?

**URL:** <https://www.ruby-forum.com/t/polymorph-without-extra-tables/92637>\
**Category:** Rails\
**Created:** [April 22, 2007, 1:22am UTC](https://www.ruby-forum.com/t/polymorph-without-extra-tables/92637 "2007-04-22T01:22:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_MacDonald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b5ac83/32.png) [@Tyler\_MacDonald](https://www.ruby-forum.com/u/Tyler_MacDonald)\
**Post date:** [April 22, 2007, 1:22am UTC](https://www.ruby-forum.com/t/polymorph-without-extra-tables/92637/1 "2007-04-22T01:22:08Z")

</div>

Here’s what I want, and the answer isn’t obvious to me ☹

Widget.Find(id)

```
- if the found widget is a "Hammer", I want the model
  object returned to be a Widget::Hammer

- if the found widget is a "Nail", I want the model
  object returned to be a Widget::Nail

```

I don’t need to store any additional attributes, I just want different  
behaviour on the model based on whether my widget is a Hammer or a Nail.  
How  
is this done? Is this something rails can do? Or will I have to override  
some method and inject my own subclass-finding logic in there?

Thanks,  
Tyler
