summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-03-12 18:32:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-03-12 18:32:36 +0000
commit6d20cfe831aef5f7487e10a74dbb15ad623d651a (patch)
tree949aab642cba2b12076a55688dd48a4d12b47b52
parent3528343863eabf0ac02bf1ec7d29eed9e2845be9 (diff)
downloadredmine-6d20cfe831aef5f7487e10a74dbb15ad623d651a.tar.gz
redmine-6d20cfe831aef5f7487e10a74dbb15ad623d651a.zip
Moves Project#users to a regular method.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11609 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/project.rb6
1 files changed, 5 insertions, 1 deletions
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