Project

General

Profile

Actions

Bug #18875

open

Fix *_name methods to use cached association

Added by Shimon Shtein about 7 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Performance
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

app/models/concerns/has_many_common.rb defines a *_name methods for each belongs_to association.
The problem is that this method in fact forces a query for each time the *_name method is accessed. This problem gets even worse if multiple hosts are queried (it becomes forced N+1), as in api hosts index action.

Actions #1

Updated by Dominic Cleal about 7 years ago

  • Category set to Performance
Actions

Also available in: Atom PDF