lib/base/chainable.js
function(options) {
    options = options || {}
    if (this.chained && options.clone !== true) return this

    var ChainModel = new this.definition.ChainGenerator(options)

    if (this.chained && options.clone === true) {
      ChainModel._internal_attributes = this.definition.store.utils.clone(
        this._internal_attributes,
        options.exclude
      )
      ChainModel._internal_attributes.cloned_relation_to = ChainModel._internal_attributes.relation_to
      ChainModel.clearInternal('relation_to')
    }

    return ChainModel.callDefaultScopes()
  }
function(options) {
    options = options || {}
    if (this.chained && options.clone !== true) return this

    var ChainModel = new this.definition.ChainGenerator(options)

    if (this.chained && options.clone === true) {
      ChainModel._internal_attributes = this.definition.store.utils.clone(
        this._internal_attributes,
        options.exclude
      )
      ChainModel._internal_attributes.cloned_relation_to = ChainModel._internal_attributes.relation_to
      ChainModel.clearInternal('relation_to')
    }

    return ChainModel.callDefaultScopes()
  }
function ( options ) { options = options || { } if ( this . chained && options . clone !== true ) return this var ChainModel = new this . definition . ChainGenerator ( options ) if ( this . chained && options . clone === true ) { ChainModel . _internal_attributes = this . definition . store . utils . clone ( this . _internal_attributes , options . exclude ) ChainModel . _internal_attributes . cloned_relation_to = ChainModel . _internal_attributes . relation_to ChainModel . clearInternal ( 'relation_to' ) } return ChainModel . callDefaultScopes ( ) }
Returns a Collection, which is in fact a cloned Model - or a chained Model
A Collectioin is an Array with all of Models' methods. All `where`, `limit`, `setContext`, ... information will be stored in this chained Model to allow asynchronous usage.

@class Model
@method chain
@param {object} options - The options hash
@param {boolean} options.clone - Clone a existing chained object. Default: false

@return {Collection}
Returns a Collection which is in fact a cloned Model - or a chained Model A Collectioin is an Array with all of Models methods . All where limit setContext ... information will be stored in this chained Model to allow asynchronous usage .