hyrax icon indicating copy to clipboard operation
hyrax copied to clipboard

Fix routes for non-work objects

Open elrayle opened this issue 4 years ago • 1 comments

Descriptive summary

Non-work models fail to conform to expected rails routing causing polymorphic_path to produce non-existing paths causing callers of this method to fail. This was seen while working with AdminSets but appears to impact Collection and FileSets as well.

Rationale

Provide the rationale or user story that describes "why" this issue should be addressed. Especially if this is a new feature or significant change to the existing implementation.

Expected behavior

>> Rails.application.routes.url_helpers.polymorphic_path(AdminSet.new(id: 3))
/admin/admin_sets/3

It should return a valid path. Currently in Hyrax, the path to show an admin set is as seen in the example. Not sure this is following an expected Rails pattern.

Actual behavior

>> Rails.application.routes.url_helpers.polymorphic_path(AdminSet.new)
NoMethodError (undefined method `admin_sets_path' ...)

Steps to reproduce the behavior

  1. In Rails console... Rails.application.routes.url_helpers.polymorphic_path(AdminSet.new(id: 3))

Related work

PR #5083 update AdminSetCreateService to create valkyrie resources

elrayle avatar Aug 25 '21 17:08 elrayle

is this still relevant?

no-reply avatar Oct 25 '23 14:10 no-reply