Let's say I am using a STI pattern to persist several different subclasses of "Transaction," which subclasses "ActiveRecord"
My subclasses might include "HighPriorityTransaction" and "LowPriorityTransaction" which rails will store in the table "transactions" with a "type" column. Each subclass has a different implementation of the before_save callback.
My question in how can I create instances of these classes by their type string value?
I am thinking that I would get the type from a combobox, instantiate that type, and let the object handle the before_save callback through polymorphism. Any additional ideas on this would be appreciated as well.
Thanks!