« ActiveResource and Associations | Main | Status »

Lesson learned

A part of my ER-Model is not correct:

The many-to-many association between Projects and Users is simply wrong. Imagine a simple case of an deletion of a relation between an User and a Project - for example the user/employee stopped working on that particular project - causes the project also to disappear from Timereports in the past.
And this is fundamentally wrong, because he surely did work on that project!

And so the connection should be between Projects and Timereports!!! Like this:

I’m pretty sure this has to be modelled this way.
Now if the user stops working on a particular project, it’s no problem to do that deletion.

Project has_many :timereports, :through => :projects_timereports
######
Timereport has_many :projects, :through => :projects_timereports
######
ProjectsTimereports has_many :timereportentries

Ok, now I’ll have to re-code that and I hope it won’t me drive nuts to do this, because I really could have avoided it!

About

DanielHi. I'm Daniel Pietzsch and this is my innoQ-Blog. I'm a 26y old student at FH Bochum and working student at innoQ.
In this blog I mainly write about the progress concerning my diploma thesis which will be an in-house application for innoQ based on Ruby on Rails, but some other (geek) stuff might appear here, too.

daniel [dot] pietzsch [alt-L] innoq [dot] com

I recommend

Categories

Recent Comments

License

Creative Commons License This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.31