Skip to content

Commit

Permalink
Fix item loading
Browse files Browse the repository at this point in the history
  • Loading branch information
johnf committed Jan 19, 2024
1 parent fd88ee8 commit 00022db
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,18 @@ def find_by_full_identifier

# So we can include things and solve N + 1 queries
def find_item
@item = Item.includes([
{ item_agents: %i[agent_role user] },
{ item_admins: %i[user] },
:collection,
:essences,
:item_countries,
:item_subject_languages,
:item_content_languages
]).find_by(identifier: params[:id])
@collection = Collection.find_by(identifier: params[:collection_id])
@item = @collection.items
.includes([
{ item_agents: %i[agent_role user] },
{ item_admins: %i[user] },
:collection,
:essences,
:item_countries,
:item_subject_languages,
:item_content_languages
])
.find_by(identifier: params[:id])
end

def save_item_catalog_file(item)
Expand Down

0 comments on commit 00022db

Please sign in to comment.