mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 19:47:14 +00:00
Optimize Issue#relations method to improve performance by fetching both relations_from and relations_to using a single database query (#39840).
Patch by Go MAEDA (@maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22572 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
a6a02971b1
commit
c13d597209
@ -1166,7 +1166,10 @@ class Issue < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def relations
|
||||
@relations ||= IssueRelation::Relations.new(self, (relations_from + relations_to).sort)
|
||||
@relations ||= IssueRelation::Relations.new(
|
||||
self,
|
||||
IssueRelation.where('issue_from_id = ? OR issue_to_id = ?', id, id).sort
|
||||
)
|
||||
end
|
||||
|
||||
def last_updated_by
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user