Hi,
I have an issue with Ruby on Rails. I have several model classes that inherit from the same class in order to have some generic behaviour.
The parent class is called CachedElement. One of the child is called Outcome.
I want an other model, called Flow to belong to any child of CachedElement. Hence Flow has a polymorphic attributes called element, to which it belongs_to
When I create a new flow, that belongs to an Outcome, the element_type is set to "CachedElement" which is the parent class, instead of "Outcome".
This is confusing because since I have several type of CachedElement which are stored in different tables, the element_id refers to several different element.
In short I would like the element_type field to refer to the child class name and not the parent class name.
How can I do that ?