mirror of
https://github.com/redmine/redmine.git
synced 2026-07-07 17:32:14 +02:00
Optimize watchers list rendering by eager loading email addresses (#42589).
Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23722 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -35,6 +35,8 @@ class Principal < ApplicationRecord
|
||||
:foreign_key => 'user_id'
|
||||
has_many :projects, :through => :memberships
|
||||
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
|
||||
# Always returns nil for groups
|
||||
has_one :email_address, lambda {where :is_default => true}, :autosave => true, :foreign_key => 'user_id'
|
||||
|
||||
validate :validate_status
|
||||
|
||||
|
||||
@@ -91,7 +91,6 @@ class User < Principal
|
||||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||||
has_one :atom_token, lambda {where "#{table.name}.action='feeds'"}, :class_name => 'Token'
|
||||
has_one :api_token, lambda {where "#{table.name}.action='api'"}, :class_name => 'Token'
|
||||
has_one :email_address, lambda {where :is_default => true}, :autosave => true
|
||||
has_many :email_addresses, :dependent => :delete_all
|
||||
belongs_to :auth_source
|
||||
|
||||
|
||||
Reference in New Issue
Block a user