增加组织表和组织课程表的关联删除

This commit is contained in:
ouyangxuhua 2015-12-02 17:38:41 +08:00
parent 9baeb850a3
commit cf41b13f3a
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ class Course < ActiveRecord::Base
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
has_many :principals, :through => :member_principals, :source => :principal
has_many :users, :through => :members
has_many :org_courses
has_many :org_courses, :dependent => :destroy
has_many :organizations, :through => :org_courses
# has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy

View File

@ -5,7 +5,7 @@ class Organization < ActiveRecord::Base
has_many :projects,:through => :org_projects
has_many :courses, :through => :org_courses
has_many :org_document_comments, :dependent => :destroy
has_many :org_courses
has_many :org_courses, :dependent => :destroy
has_many :users, :through => :org_members
validates_uniqueness_of :name
after_create :save_as_org_activity