Skip to content

Commit

Permalink
🐛 User couldn't edit file sets
Browse files Browse the repository at this point in the history
parent_doc is not a solr document, so calling ['has_model_ssim'] produced and error.
  • Loading branch information
ShanaLMoore committed Apr 19, 2024
1 parent 29f7e33 commit 72b693a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/helpers/hyku_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ def admin_only_tenant_creation?
end

def parent_path(parent_doc)
model = parent_doc['has_model_ssim'].first
path = "hyrax_#{model.underscore}_path"
model = case parent_doc
when ActiveFedora::Base
parent_doc
when SolrDocument
parent_doc['has_model_ssim'].first.constantize
else
raise "Unknown parent_doc type: #{parent_doc.class}"
end

path = "#{model.model_name.singular_route_key}_path"
main_app.send(path, parent_doc.id)
end
end

0 comments on commit 72b693a

Please sign in to comment.