Hello guys,
Need help!! Finding it hard to model the ‘model’ within the given
rails associations.
In java terms, my requirements are…
There are 3 entities - module, chapter and activity.
Chapter entity is a specilization of Module entity (inheritence)
Activity entity is a specialization of Module entity (inheritence)
And the tables would have looked like:
- Module table = Module_Id, Entity_type, …
- Chapter = Chapter_id, …
- Activity = Activity_id, …
Hence, if I create a chapter then the tables would be populated as:
Module table = Module_Id, Entity_type, … = values ( 100,
chapter , … )
Chapter table = chapter_id, … = values ( 100, … )
Basically, the ids of chapter and module would be same and module
table would store the type.
Now, if I create a activity then the tables would be populated as:
Module table = Module_Id, Entity_type, … = values ( 101,
activity , … )
Activity table = activity_id, … = values ( 100, … )
Basically, the ids of activity and module would be same and module
table would store the type.
Can you please guide me how I can model it similarly in rails 2.3.2?
Thanks in advance
Ritvvij Parrilkh