Topic: has many with polimorphic association?

i have a model for Companies, periods and a namespace for departments. so the user submit values for their company departments on each period. for example the production rate on a current perios. the thing is... should i add period id and company id attributes to every model under departments or should i just add the  company id and add the period in a new model called companydepartments that accepts each department as polimorphic the period id and the company id. i accepts ideas too

Re: has many with polimorphic association?

Firstly conentrtate on the database design indepemndantly of any rails code you may or may not wish to use
If it makes sense from a database normalisation point of view then rails will have helper methods to make it easy to model your database design.
What I'm saying is that before you even think about models start thinking about entities and entity relationships. Only then should you think about the actual rails code you will need.

Just feel comfortable that if your design is good it will be easy to model in Rails. If it's bad Rails will give you a headache.

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)