Quantcast
Viewing all articles
Browse latest Browse all 4829

Customize adapter's pathForType to include the related model's id

@pragatheeswarans wrote:

Suppose, I have a model like the following.

// models/post.js
author: attr('string'),
title: attr('string'),
views: attr('number'),
comments: hasMany('comment')

Now, if i want to reload a particular comment using comment.reload(), my server has the URL in the format

/api/posts/:post_id/comments/:comment_id

I would like to know what is the best way to construct this url in the comments adapter?

Until now I am taking the currentURL from the router service which will have the post id and then constructing it manually. Is there any other better approach to this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles