Skip to content

Instantly share code, notes, and snippets.

@ghempton
Created March 30, 2014 23:58
Show Gist options
  • Save ghempton/9882197 to your computer and use it in GitHub Desktop.
Save ghempton/9882197 to your computer and use it in GitHub Desktop.
EPF Adapter URL API
Adapter.map(function() {
this.resources('post', {path: '/blog-posts/:post_id'}, function() {
this.resources('comments'); // assumes has-many called 'comments' and inverse called 'post'
this.resource('owner', {type: 'user'});
});
});
session.create('comment', {post: post});
@jimsynz
Copy link

jimsynz commented Mar 31, 2014

I like the create syntax, but what about find?

For example:

  @session.find('comment', {post: post})

would be interpreted as a findQuery. My suggestion is to have the any find on a nested resource raise an exception and make people use @session.find('post', 1).get('comments') instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment