16 lines
313 B
Ruby
16 lines
313 B
Ruby
|
class CourseGroup < ActiveRecord::Base
|
||
|
# attr_accessible :title, :body
|
||
|
belongs_to :course
|
||
|
has_many :members
|
||
|
|
||
|
before_destroy :set_member_nil
|
||
|
|
||
|
attr_accessible :name
|
||
|
|
||
|
def set_member_nil
|
||
|
if self.members && self.members.count > 0
|
||
|
self.members.update_all("course_group_id = 0")
|
||
|
end
|
||
|
end
|
||
|
end
|