Is it possible to pass parameters like this? I need to pass some information that is not part of the model itself.
myModel.save({site : 23})
It is possible if you:
serializeIntoHash
method.For instance:
App.Model = DS.Model.extend({
//...
site: DS.attr('number', { serialize: false })
});
App.ModelSerializer = DS.RESTSerializer.extend({
serializeIntoHash: function(hash, type, record, options) {
this._super(hash, type, record, options);
Ember.merge(hash, {
'site': record.get('site')
});
}
});
See this comment, this is the correct way to achieve your goal.