Skip to content

Commit

Permalink
Merge pull request #4772 from knownasilya/patch-3
Browse files Browse the repository at this point in the history
[DOC] Shorthand method syntax, quotes, and cleanup
  • Loading branch information
bmac authored Jan 26, 2017
2 parents 440cae6 + 73b02dc commit b6b4df1
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions addon/-private/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Store = Service.extend({
```js
store.createRecord('post', {
title: "Rails is omakase"
title: 'Rails is omakase'
});
```
Expand All @@ -328,7 +328,7 @@ Store = Service.extend({
```js
let user = this.store.peekRecord('user', 1);
store.createRecord('post', {
title: "Rails is omakase",
title: 'Rails is omakase',
user: user
});
```
Expand Down Expand Up @@ -409,7 +409,7 @@ Store = Service.extend({
```javascript
let post = store.createRecord('post', {
title: "Rails is omakase"
title: 'Rails is omakase'
});
store.deleteRecord(post);
Expand Down Expand Up @@ -484,7 +484,7 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
model(params) {
return this.store.findRecord('post', params.post_id);
}
});
Expand Down Expand Up @@ -543,7 +543,7 @@ Store = Service.extend({
// }
// ]
store.findRecord('post', 1, { reload: true }).then(function(post) {
post.get("revision"); // 2
post.get('revision'); // 2
});
```
Expand Down Expand Up @@ -604,7 +604,7 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
model(params) {
return this.store.findRecord('post', params.post_id, { backgroundReload: false });
}
});
Expand All @@ -617,7 +617,7 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
model(params) {
return this.store.findRecord('post', params.post_id, {
adapterOptions: { subscribe: false }
});
Expand All @@ -629,7 +629,7 @@ Store = Service.extend({
import MyCustomAdapter from './custom-adapter';
export default MyCustomAdapter.extend({
findRecord: function(store, type, id, snapshot) {
findRecord(store, type, id, snapshot) {
if (snapshot.adapterOptions.subscribe) {
// ...
}
Expand Down Expand Up @@ -658,8 +658,8 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id, {include: 'comments'});
model(params) {
return this.store.findRecord('post', params.post_id, { include: 'comments' });
}
});
Expand All @@ -676,8 +676,8 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id, {include: 'comments,comments.author'});
model(params) {
return this.store.findRecord('post', params.post_id, { include: 'comments,comments.author' });
}
});
Expand Down Expand Up @@ -981,7 +981,7 @@ Store = Service.extend({
let user = userRef.value();
// get the identifier of the reference
if (userRef.remoteType() === "id") {
if (userRef.remoteType() === 'id') {
let id = userRef.id();
}
Expand All @@ -992,8 +992,8 @@ Store = Service.extend({
userRef.reload().then(...)
// provide data for reference
userRef.push({ id: 1, username: "@user" }).then(function(user) {
userRef.value() === user;
userRef.push({ id: 1, username: '@user' }).then(function(user) {
userRef.value() === user;
});
```
Expand Down Expand Up @@ -1077,8 +1077,8 @@ Store = Service.extend({
```javascript
store.hasRecordForId('post', 1); // false
store.findRecord('post', 1).then(function() {
store.hasRecordForId('post', 1); // true
});
store.hasRecordForId('post', 1); // true
});
```
@method hasRecordForId
Expand Down Expand Up @@ -1309,11 +1309,11 @@ Store = Service.extend({
The request is made through the adapters' `queryRecord`:
```app/adapters/user.js
import DS from "ember-data";
import DS from 'ember-data';
export default DS.Adapter.extend({
queryRecord(modelName, query) {
return Ember.$.getJSON("/api/current_user");
return Ember.$.getJSON('/api/current_user');
}
});
```
Expand Down Expand Up @@ -1401,7 +1401,7 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
model(params) {
return this.store.findAll('author');
}
});
Expand Down Expand Up @@ -1433,7 +1433,7 @@ Store = Service.extend({
// }
// ]
store.findAll('author', { reload: true }).then(function(authors) {
authors.getEach("id"); // ['first', 'second']
authors.getEach('id'); // ['first', 'second']
});
```
Expand Down Expand Up @@ -1494,7 +1494,7 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
model() {
return this.store.findAll('post', { backgroundReload: false });
}
});
Expand All @@ -1507,7 +1507,7 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
model(params) {
return this.store.findAll('post', {
adapterOptions: { subscribe: false }
});
Expand All @@ -1519,7 +1519,7 @@ Store = Service.extend({
import MyCustomAdapter from './custom-adapter';
export default MyCustomAdapter.extend({
findAll: function(store, type, sinceToken, snapshotRecordArray) {
findAll(store, type, sinceToken, snapshotRecordArray) {
if (snapshotRecordArray.adapterOptions.subscribe) {
// ...
}
Expand Down Expand Up @@ -1549,8 +1549,8 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.store.findAll('post', {include: 'comments'});
model() {
return this.store.findAll('post', { include: 'comments' });
}
});
Expand All @@ -1564,8 +1564,8 @@ Store = Service.extend({
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return this.store.findAll('post', {include: 'comments,comments.author'});
model() {
return this.store.findAll('post', { include: 'comments,comments.author' });
}
});
Expand Down Expand Up @@ -2019,7 +2019,7 @@ Store = Service.extend({
In case someone defined a relationship to a mixin, for example:
```
let Comment = DS.Model.extend({
owner: belongsTo('commentable'. { polymorphic: true})
owner: belongsTo('commentable'. { polymorphic: true })
});
let Commentable = Ember.Mixin.create({
comments: hasMany('comment')
Expand Down

0 comments on commit b6b4df1

Please sign in to comment.