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