Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polymorphic links on serialised project response. #311

Closed
camallen opened this issue Nov 24, 2014 · 1 comment
Closed

Polymorphic links on serialised project response. #311

camallen opened this issue Nov 24, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@camallen
Copy link
Contributor

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?

@edpaget
Copy link
Contributor

edpaget commented Nov 24, 2014

@camallen I converted all our serializers to AMS in my branch https://github.com/edpaget/Panoptes/tree/ams. I'm not going to be working on it again until next week. There's a bunch of stuff that broke that I still need to resolve.

@edpaget edpaget self-assigned this Dec 1, 2014
@edpaget edpaget closed this as completed in 424ed69 Dec 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants