Skip to content

Commit 36e08a9

Browse files
[api] even more correct eager loading
1 parent 2006a57 commit 36e08a9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/api/lib/xpath_engine.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,10 @@ def find(xpath)
304304
when 'issues'
305305
relation = Issue.all
306306
when 'binaries'
307-
relation = BinaryRelease.includes(repository:[{product_medium: [{product: [{package: :project}]}]}])
308-
# relation = BinaryRelease.all
307+
relation = BinaryRelease.includes(
308+
:repository => [ {:product_medium => {:product => {:package => :project}}},
309+
{:product_update_repositories => :product} ])
310+
309311
@joins = ['LEFT JOIN repositories AS release_repositories ON binary_releases.repository_id = release_repositories.id',
310312
'LEFT JOIN projects AS release_projects ON release_repositories.db_project_id = release_projects.id'] << @joins
311313
order = :binary_releasetime

src/api/test/functional/binary_release_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_search_binary_release_in_fixtures
8686
assert_response :success
8787
assert_xml_tag :tag => "binary", :attributes => { :project => "BaseDistro3", :repository => "BaseDistro3_repo", :name => "package", :version => "1.0", :release => "1", :arch => "i586"}
8888
assert_xml_tag :tag => "updatefor", :attributes => { project: "BaseDistro", product: "fixed" }
89+
assert_xml_tag :tag => "product", :attributes => { project: "BaseDistro", name: "fixed", medium: "DVD" }
8990

9091
end
9192

0 commit comments

Comments
 (0)