module.exports = Backbone.Collection.extend({
	constructor: function(attributes, options) {
		Backbone.Collection.apply(this, arguments);

		if(!this.model)
			this.model = require('ridge/model');

		return this;
	},

	parse: function(resp) {
		if(_.isObject(resp)) {
			_.extend(this, _.pick(resp, 'totalCount', 'perPage'));

			return _.find(resp, _.isArray);
		}

		return resp;
	}
});

module.exports = Backbone.Collection.extend({
	constructor: function(attributes, options) {
		Backbone.Collection.apply(this, arguments);

		if(this.model === Backbone.Model) 
			this.model = require('ridge/model');

		return this;
	},

	parse: function(resp) {
		if(_.isPlainObject(resp)) {
			_.extend(this, _.pick(resp, 'totalCount', 'perPage'));

			return _.find(resp, _.isArray);
		}

		return resp;
	}
});

Test if resp isPlainObject and replace this.model with ridge/model if it is default value of Backbone.Model.
Test if resp isPlainObject and replace this.model with ridge/model if it is default value of Backbone.Model.
