Skip to content

Instantly share code, notes, and snippets.

@kapouer
Created September 7, 2015 09:39
Show Gist options
  • Save kapouer/002d9d27322e81ac202a to your computer and use it in GitHub Desktop.
Save kapouer/002d9d27322e81ac202a to your computer and use it in GitHub Desktop.
Resource.relationMappings = {
27 + children: {
28 + relation: Model.ManyToManyRelation,
29 + modelClass: Resource,
30 + join: {
31 + from: 'raja_resources.id',
32 + through: {
33 + from: 'raja_relations.parent_id',
34 + to: 'raja_relations.child_id'
35 + },
36 + to: 'raja_resources.id'
37 + },
38 + filter: function(query) {
39 + query.orderBy('order');
40 + }
41 + },
42 + parents: {
43 + relation: Model.ManyToManyRelation,
44 + modelClass: Resource,
45 + join: {
46 + from: 'raja_resources.id',
47 + through: {
48 + from: 'raja_relations.child_id',
49 + to: 'raja_relations.parent_id'
50 + },
51 + to: 'raja_resources.id'
52 + },
53 + filter: function(query) {
54 + query.orderBy('order');
55 + }
56 + }
57 + };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment