diff --git a/app/models/member.rb b/app/models/member.rb index de4d67687..8901ec52f 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -22,8 +22,9 @@ class Member < ActiveRecord::Base has_many :roles, :through => :member_roles belongs_to :project + belongs_to :course - validates_presence_of :principal, :project + validates_presence_of :principal validates_uniqueness_of :user_id, :scope => :project_id validate :validate_role diff --git a/app/models/project.rb b/app/models/project.rb index b8e11d99e..45e251f5b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -38,7 +38,7 @@ class Project < ActiveRecord::Base :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})" has_many :users, :through => :members has_many :principals, :through => :member_principals, :source => :principal - has_many :enabled_modules, :dependent => :delete_all + has_many :enabled_modules, :dependent => :delete_all has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position" has_many :issues, :dependent => :destroy, :include => [:status, :tracker] has_many :issue_changes, :through => :issues, :source => :journals