No, it makes no sense, because my question relates to custom implementation of the findOne.
In fact,
i missed ajax parameter 'json foo.models' that makes $.ajax to call Foo.models(response) to convert data to models.
The method is documented here: http://javascriptmvc.com/docs.html#!jQuery.Model.static.model
In custom non-AJAX/non-REST implementations this should be called manually.
But it is not quite clean what is difference between new Model(data) and Model.model(data)
The implementation is:
- model: function( attributes ) {
- if (!attributes ) {
- return null;
- }
- if ( attributes instanceof this ) {
- attributes = attributes.serialize();
- }
- return new this(
- // checks for properties in an object (like rails 2.0 gives);
- isObject(attributes[this._shortName]) || isObject(attributes.data) || isObject(attributes.attributes) || attributes);
- },