{"action":"created","issue":{"url":"https://api.github.com/repos/dchester/epilogue/issues/124","labels_url":"https://api.github.com/repos/dchester/epilogue/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/dchester/epilogue/issues/124/comments","events_url":"https://api.github.com/repos/dchester/epilogue/issues/124/events","html_url":"https://github.com/dchester/epilogue/issues/124","id":121749731,"number":124,"title":"Add an option to not auto-populate associations on source endpoints","user":{"login":"sdebionne","id":4699120,"avatar_url":"https://avatars.githubusercontent.com/u/4699120?v=3","gravatar_id":"","url":"https://api.github.com/users/sdebionne","html_url":"https://github.com/sdebionne","followers_url":"https://api.github.com/users/sdebionne/followers","following_url":"https://api.github.com/users/sdebionne/following{/other_user}","gists_url":"https://api.github.com/users/sdebionne/gists{/gist_id}","starred_url":"https://api.github.com/users/sdebionne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdebionne/subscriptions","organizations_url":"https://api.github.com/users/sdebionne/orgs","repos_url":"https://api.github.com/users/sdebionne/repos","events_url":"https://api.github.com/users/sdebionne/events{/privacy}","received_events_url":"https://api.github.com/users/sdebionne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-11T16:56:46Z","updated_at":"2015-12-14T15:21:03Z","closed_at":null,"body":"I'm considering a PR to add an option (or change the behavior) of resources with associations. I don't think it is correct to return a resource and its associations when the source resource endpoints are called without specifying an association. In a typical use case where we have users and projects,  `/users` or `/users/:id` should not return associated projects.\r\n\r\nThis has already been discussed before in #34 and #85 but without a consensus on what the expect behavior should be. So what about an option?\r\n\r\n```javascript\r\nresources.sites = epilogue.resource({\r\n  model: models.User,\r\n  endpoints: ['/users', '/users/:uid'],\r\n  associations: {\r\n    autoPopulate: false\r\n  }\r\n});\r\n```\r\n\r\n`autoPopulate: true` would be the default to keep backward compatibility."},"comment":{"url":"https://api.github.com/repos/dchester/epilogue/issues/comments/164464635","html_url":"https://github.com/dchester/epilogue/issues/124#issuecomment-164464635","issue_url":"https://api.github.com/repos/dchester/epilogue/issues/124","id":164464635,"user":{"login":"sdebionne","id":4699120,"avatar_url":"https://avatars.githubusercontent.com/u/4699120?v=3","gravatar_id":"","url":"https://api.github.com/users/sdebionne","html_url":"https://github.com/sdebionne","followers_url":"https://api.github.com/users/sdebionne/followers","following_url":"https://api.github.com/users/sdebionne/following{/other_user}","gists_url":"https://api.github.com/users/sdebionne/gists{/gist_id}","starred_url":"https://api.github.com/users/sdebionne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdebionne/subscriptions","organizations_url":"https://api.github.com/users/sdebionne/orgs","repos_url":"https://api.github.com/users/sdebionne/repos","events_url":"https://api.github.com/users/sdebionne/events{/privacy}","received_events_url":"https://api.github.com/users/sdebionne/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T15:21:02Z","updated_at":"2015-12-14T15:21:02Z","body":"I have just tested #122 and that sounds like a good start, e.g same kind of modifications should be applied to `list.js`.\r\n\r\nI wonder if we should have two distincts options for singular and plural endpoints:\r\n\r\n```javascript\r\nresources.sites = epilogue.resource({\r\n  model: models.User,\r\n  endpoints: ['/users', '/users/:uid'],\r\n  associations: {\r\n    autoPopulate: [false, true]\r\n  }\r\n});\r\n```\r\n\r\nIt may be handy to auto-populate the associations for singular endpoint while not fetching everything for the plural one."}}