mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Add 'beforeCreate' hook in rest model
This commit is contained in:
parent
13e9d2867a
commit
962db8c759
1 changed files with 3 additions and 0 deletions
|
@ -3,6 +3,7 @@ const RestModel = Ember.Object.extend({
|
||||||
isCreated: Ember.computed.equal('__state', 'created'),
|
isCreated: Ember.computed.equal('__state', 'created'),
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
|
|
||||||
|
beforeCreate() { },
|
||||||
afterUpdate() { },
|
afterUpdate() { },
|
||||||
|
|
||||||
update(props) {
|
update(props) {
|
||||||
|
@ -34,6 +35,8 @@ const RestModel = Ember.Object.extend({
|
||||||
|
|
||||||
props = props || this.createProperties();
|
props = props || this.createProperties();
|
||||||
|
|
||||||
|
this.beforeCreate(props);
|
||||||
|
|
||||||
const type = this.get('__type'),
|
const type = this.get('__type'),
|
||||||
store = this.get('store'),
|
store = this.get('store'),
|
||||||
adapter = store.adapterFor(type);
|
adapter = store.adapterFor(type);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue