I have a DS.Model
with some nested keys:
export default DS.Model.extend({
name: DS.attr('string'),
slug: DS.attr('string'),
status: DS.attr('string'),
config: DS.attr('', {
defaultValue: {
url: '',
connections: 5,
request_timeout: 2000,
etc...
}
})
...
})
And a new
route that creates a model for passing to a form:
export default Ember.Route.extend({
model() {
return this.store.createRecord('resource');
},
...
After creating a new model via the form at /resource/new
, on revisiting the form the config
is still set to the values of the last created model.
I can see via Ember Inspector that the model is a different instance (having stored a reference to oldModel
before leaving the page on the initial create):
oldModel.toString()
"<web@model:app::ember731:null>"
oldModel.get('config.url')
"http://localhost:4000/old"
newModel = $E
newModel.toString()
"<web@model:app::ember894:null>"
newModel.get('config.url')
"http://localhost:4000/old"