diff --git a/app/models/project.rb b/app/models/project.rb index 86af292b1..f4e5c9f7a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -33,7 +33,6 @@ class Project < ActiveRecord::Base has_many :member_principals, :class_name => 'Member', :include => :principal, :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 :enabled_modules, :dependent => :delete_all has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position" @@ -218,6 +217,10 @@ class Project < ActiveRecord::Base @principals ||= Principal.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq end + def users + @users ||= User.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq + end + # Returns the Systemwide and project specific activities def activities(include_inactive=false) if include_inactive @@ -291,6 +294,7 @@ class Project < ActiveRecord::Base alias :base_reload :reload def reload(*args) @principals = nil + @users = nil @shared_versions = nil @rolled_up_versions = nil @rolled_up_trackers = nil