v3: avoid n+1 query for last_build on the default branch when loading a list of repositories

This commit is contained in:
Konstantin Haase 2015-04-28 22:08:27 +02:00
parent c3e96c4a55
commit 075e2d1c6c

View File

@ -19,7 +19,7 @@ module Travis::API::V3
list = list.where(private: bool(private)) unless private.nil?
list = list.includes(:owner) if includes? 'repository.owner'.freeze
list = list.includes(:last_build) if includes? 'repository.last_build'.freeze
list = list.includes(:default_branch)
list = list.includes(default_branch: :last_build)
list
end
end