From 6d20cfe831aef5f7487e10a74dbb15ad623d651a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 12 Mar 2013 18:32:36 +0000 Subject: Moves Project#users to a regular method. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11609 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/project.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3