Moves Project#users to a regular method.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11609 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-03-12 18:32:36 +00:00
parent 3528343863
commit 6d20cfe831
1 changed files with 5 additions and 1 deletions

View File

@ -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