samvera / hyrax

Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
http://hyrax.samvera.org/
Apache License 2.0
185 stars 124 forks source link

Fix routes for non-work objects #5085

Open elrayle opened 3 years ago

elrayle commented 3 years ago

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

no-reply commented 1 year ago

is this still relevant?