{"action":"created","issue":{"url":"https://api.github.com/repos/nolanlawson/ember-pouch/issues/89","labels_url":"https://api.github.com/repos/nolanlawson/ember-pouch/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/nolanlawson/ember-pouch/issues/89/comments","events_url":"https://api.github.com/repos/nolanlawson/ember-pouch/issues/89/events","html_url":"https://github.com/nolanlawson/ember-pouch/pull/89","id":104426770,"number":89,"title":"db can now be switched dynamically on the adapter","user":{"login":"olivierchatry","id":1267483,"avatar_url":"https://avatars.githubusercontent.com/u/1267483?v=3","gravatar_id":"","url":"https://api.github.com/users/olivierchatry","html_url":"https://github.com/olivierchatry","followers_url":"https://api.github.com/users/olivierchatry/followers","following_url":"https://api.github.com/users/olivierchatry/following{/other_user}","gists_url":"https://api.github.com/users/olivierchatry/gists{/gist_id}","starred_url":"https://api.github.com/users/olivierchatry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivierchatry/subscriptions","organizations_url":"https://api.github.com/users/olivierchatry/orgs","repos_url":"https://api.github.com/users/olivierchatry/repos","events_url":"https://api.github.com/users/olivierchatry/events{/privacy}","received_events_url":"https://api.github.com/users/olivierchatry/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-02T08:29:21Z","updated_at":"2015-09-02T15:08:03Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nolanlawson/ember-pouch/pulls/89","html_url":"https://github.com/nolanlawson/ember-pouch/pull/89","diff_url":"https://github.com/nolanlawson/ember-pouch/pull/89.diff","patch_url":"https://github.com/nolanlawson/ember-pouch/pull/89.patch"},"body":"This patch allows to switch dynamically a pouch DB on the adapter. This can be very useful if you have one model that can represent different databases. "},"comment":{"url":"https://api.github.com/repos/nolanlawson/ember-pouch/issues/comments/137117720","html_url":"https://github.com/nolanlawson/ember-pouch/pull/89#issuecomment-137117720","issue_url":"https://api.github.com/repos/nolanlawson/ember-pouch/issues/89","id":137117720,"user":{"login":"olivierchatry","id":1267483,"avatar_url":"https://avatars.githubusercontent.com/u/1267483?v=3","gravatar_id":"","url":"https://api.github.com/users/olivierchatry","html_url":"https://github.com/olivierchatry","followers_url":"https://api.github.com/users/olivierchatry/followers","following_url":"https://api.github.com/users/olivierchatry/following{/other_user}","gists_url":"https://api.github.com/users/olivierchatry/gists{/gist_id}","starred_url":"https://api.github.com/users/olivierchatry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivierchatry/subscriptions","organizations_url":"https://api.github.com/users/olivierchatry/orgs","repos_url":"https://api.github.com/users/olivierchatry/repos","events_url":"https://api.github.com/users/olivierchatry/events{/privacy}","received_events_url":"https://api.github.com/users/olivierchatry/received_events","type":"User","site_admin":false},"created_at":"2015-09-02T15:08:03Z","updated_at":"2015-09-02T15:08:03Z","body":"Hey ! Sure :)\r\nSo I'm making a software that have many different clients. All these clients have many different project. All of these project needs to be very well separated ( even on a user basis ).\r\n\r\nSo what I have done is that I have a private DB that can only be accessed from a backend. The backend then create a couchdb for each project, and set the right roles for a given user. ( my users are actually glorified couchdb users).\r\n\r\nWhen a user open a project, I actually dynamically change the database object inside the project adapter. This is working quite well right now ( as long as you are sure that their will be only one active project at a time, which is my case, and I would guess the most common case). \r\n\r\nThis allows me to leverage couch security system, as well as having offline possibility with pouch, and the user only have on the local computer what he really needs to have access to.\r\n\r\nNote that, on the store side, I have also to clear all the loaded with :\r\n```javascript\r\nthis.store.unloadAll('project')\r\n```"}}