summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-03-12 18:07:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-03-12 18:07:37 +0000
commit3528343863eabf0ac02bf1ec7d29eed9e2845be9 (patch)
tree0d2f76fde5ebf2473e253532b4389bac72b4a2f1 /app
parent248d983a7d8ba1a0e505c41b46c3f13acd2388cd (diff)
downloadredmine-3528343863eabf0ac02bf1ec7d29eed9e2845be9.tar.gz
redmine-3528343863eabf0ac02bf1ec7d29eed9e2845be9.zip
Moves Project#principals to a regular method.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11608 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-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 49fa9dcde..86af292b1 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -34,7 +34,6 @@ class Project < ActiveRecord::Base
: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 :principals, :through => :member_principals, :source => :principal
has_many :enabled_modules, :dependent => :delete_all
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
@@ -215,6 +214,10 @@ class Project < ActiveRecord::Base
end
end
+ def principals
+ @principals ||= Principal.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
@@ -287,6 +290,7 @@ class Project < ActiveRecord::Base
alias :base_reload :reload
def reload(*args)
+ @principals = nil
@shared_versions = nil
@rolled_up_versions = nil
@rolled_up_trackers = nil