I want to I achieve the following model structure in my Rails application having 3 separate tables - Value, DecimalValue and TextValue - in which DecimalValue and TextValue inherit from Value. The idea is that Value should contain only the id, and the child tables should refer to that id. How can I implement this based o ROR?
Value model (id, type) DecimalValue (value_id, value:decimal) TextValue (value_id, value:string)
Thanks in advance!
You should try Polymorphic Associations.
Here is good RailsCast about it