Last active
February 7, 2018 16:34
-
-
Save jelhan/635aa7fc885bcb705be4103c44d65606 to your computer and use it in GitHub Desktop.
ember-awesome-macros#423
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import { groupBy } from 'ember-awesome-macros/array'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
postsGroupedByAuthor: groupBy('model', 'postsGroupedBy'), | |
postsGroupedBy: 'author' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
author: attr('string'), | |
title: attr('string') | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const { A } = Ember; | |
export default Ember.Route.extend({ | |
model() { | |
let store = this.get('store'); | |
return A([ | |
store.createRecord('post', { | |
author: 'max', | |
title: 'post by max' | |
}), | |
store.createRecord('post', { | |
author: 'max', | |
title: 'another post by max' | |
}), | |
store.createRecord('post', { | |
author: 'maria', | |
title: 'post by maria' | |
}) | |
]); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.13.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-awesome-macros": "0.41.0", | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment