On Jun 7, 3:29 am, Ritvvij <ritvi...@gmail.com> wrote:
> Hello guys,
>
> Need help!! Finding it hard to model the 'model' :P 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:
> 1. Module table = Module_Id, Entity_type, ....
> 2. Chapter = Chapter_id, .....
> 3. 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.
>
That wouldn't be the rails way of doing  it. In rails you'd probably
either use single table inheritance or a polymorphic association.

Fred


> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to