Skip to content

Polymorphic links on serialised project response. #311

@camallen

Description

@camallen

Linked to #115 - The project owner relation is a polymorphic belongs_to (User & UserGroup). The serialised response returns the link to /owner which is not a valid URL.

"links"=>
  {"projects.workflows"=>{"href"=>"/workflows?project_id={projects.id}", "type"=>"workflows"},
   "projects.subject_sets"=>{"href"=>"/subject_sets?project_id={projects.id}", "type"=>"subject_sets"},
   "projects.owner"=>{"href"=>"/owners/{projects.owner}", "type"=>"owners"},
   "projects.project_contents"=>{"href"=>"/project_contents?project_id={projects.id}", "type"=>"project_contents"},
   "projects.project_roles"=>{"href"=>"/project_roles?project_id={projects.id}", "type"=>"project_roles"}}

We need to:
a) override the href in the serialiser
b) patch restpack-serializer to handle the polymorphic relations (RestPack/restpack_serializer#81)
c) Investigate porting to ActiveModelSerialisers, seems they handle polymorphic relations by default - @edpaget thoughts?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions