Simplify model registration

This commit is contained in:
Toby Zerner 2015-05-05 17:05:02 +09:30
parent d4e8276b3f
commit ba5b79451b
2 changed files with 6 additions and 10 deletions

View File

@ -9,10 +9,10 @@ import Notification from 'flarum/models/notification';
export default function(app) {
app.store = new Store();
app.store.model('users', User);
app.store.model('discussions', Discussion);
app.store.model('posts', Post);
app.store.model('groups', Group);
app.store.model('activity', Activity);
app.store.model('notifications', Notification);
app.store.models['users'] = User;
app.store.models['discussions'] = Discussion;
app.store.models['posts'] = Post;
app.store.models['groups'] = Group;
app.store.models['activity'] = Activity;
app.store.models['notifications'] = Notification;
};

View File

@ -55,10 +55,6 @@ export default class Store {
return data ? Object.keys(data).map(id => data[id]) : [];
}
model(type, Model) {
this.models[type] = Model;
}
createRecord(type, data) {
data = data || {};
data.type = data.type || type;