Skip to content

Commit

Permalink
fix N+1 query in ONI API
Browse files Browse the repository at this point in the history
  • Loading branch information
johnf committed May 28, 2024
1 parent a9c158f commit 00e78f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/oni_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def object_meta
md = params[:id].match(repository_item_url(collection_identifier: '(.*)', item_identifier: '(.*)'))
if md
@collection = Collection.find_by(identifier: md[1])
@data = @collection.items.find_by(identifier: md[2])
@data = @collection.items.includes(:content_languages, :subject_languages, item_agents: %i[agent_role user]).find_by(identifier: md[2])
@is_item = true
else
md = params[:id].match(repository_collection_url(collection_identifier: '(.*)'))
Expand Down

0 comments on commit 00e78f4

Please sign in to comment.