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:
parent
3528343863
commit
6d20cfe831
|
@ -33,7 +33,6 @@ class Project < ActiveRecord::Base
|
||||||
has_many :member_principals, :class_name => 'Member',
|
has_many :member_principals, :class_name => 'Member',
|
||||||
:include => :principal,
|
:include => :principal,
|
||||||
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
|
: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_many :enabled_modules, :dependent => :delete_all
|
||||||
has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position"
|
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
|
@principals ||= Principal.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def users
|
||||||
|
@users ||= User.active.joins(:members).where("#{Member.table_name}.project_id = ?", id).uniq
|
||||||
|
end
|
||||||
|
|
||||||
# Returns the Systemwide and project specific activities
|
# Returns the Systemwide and project specific activities
|
||||||
def activities(include_inactive=false)
|
def activities(include_inactive=false)
|
||||||
if include_inactive
|
if include_inactive
|
||||||
|
@ -291,6 +294,7 @@ class Project < ActiveRecord::Base
|
||||||
alias :base_reload :reload
|
alias :base_reload :reload
|
||||||
def reload(*args)
|
def reload(*args)
|
||||||
@principals = nil
|
@principals = nil
|
||||||
|
@users = nil
|
||||||
@shared_versions = nil
|
@shared_versions = nil
|
||||||
@rolled_up_versions = nil
|
@rolled_up_versions = nil
|
||||||
@rolled_up_trackers = nil
|
@rolled_up_trackers = nil
|
||||||
|
|
Loading…
Reference in New Issue