Skip to content

Change access to db property to use Ember.get#84

Merged
rsutphin merged 1 commit intopouchdb-community:masterfrom
HospitalRun:master
Jul 29, 2015
Merged

Change access to db property to use Ember.get#84
rsutphin merged 1 commit intopouchdb-community:masterfrom
HospitalRun:master

Conversation

@jkleinsc
Copy link
Copy Markdown
Collaborator

Right now in the ember adapter, the code is using this.db to reference the PouchDB used. For most use cases this works fine, but it doesn't work if you are trying to set the db via injection doing something like this:

var configDB = new PouchDB('config');
application.register('pouchdb:configdb', configDB, {instantiate: false});
application.inject('adapter', 'db', 'pouchdb:configdb');  

In the example above this.db will be undefined, but this.get('db') will return the defined PouchDB.

This pull request simply changes the this.db references to this.get('db') so that the PouchDB can be injected or can be used the way it is defined in the readme.

@rsutphin
Copy link
Copy Markdown
Collaborator

@jkleinsc, thanks for this. It's a good idea. Can you rebase to get rid of that merge commit? If not I'll take care of it in the next few days.

…cted

Using this.db doesn’t work when injecting a PouchDB into the adapter.
In the case of an injected property, you need to use this.get(‘db’).
@jkleinsc
Copy link
Copy Markdown
Collaborator Author

@rsutphin I rebased and got rid of the merge commit. Thanks!

rsutphin added a commit that referenced this pull request Jul 29, 2015
Change access to db property to use Ember.get
@rsutphin rsutphin merged commit 202d0b5 into pouchdb-community:master Jul 29, 2015
@rsutphin
Copy link
Copy Markdown
Collaborator

Thanks!

@rsutphin
Copy link
Copy Markdown
Collaborator

Released as 2.0.3.

rsutphin added a commit that referenced this pull request Jul 30, 2015
@nolanlawson
Copy link
Copy Markdown
Member

👍, thanks for the PR! :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants