cit-jmu/workshop — pull request #8 by leightonshank (2014-12-09 21:30:20+00:00)
Title: Remove parts when a section is removed

The Section model had a has_many relationship to a Part, but there was
no 'dependent: :destroy' option, so when a section was removed the
Part(s) were still hanging out. This caused an error on the calendar
because it is driven by pulling all parts, and then working up through
the relations to get to sections and courses. When a part doesn't have
a section, things get a bit wonky.

Also added 'dependent: :destroy' for the has_many :enrollments relations
on both the User and Section model. The way I figure it, if a Section
is removed, it doesn't make any sense to have the enrollments hanging
out, same goes for when a User is removed. They don't need their
enrollments either.