socialforge/app/models/course_group.rb

16 lines
313 B
Ruby
Raw Normal View History

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