build/rekord.js
function(input, callback, context, remoteData)
  {
    var db = this;
    var promise = new Promise();

    promise.success( callback, context || db );

    function checkModel()
    {
      var result = db.parseModel( input, remoteData );

      if ( result !== false && !promise.isComplete() && db.initialized )
      {
        var remoteLoaded = db.remoteLoaded || !db.hasLoad( Load.All );
        var missingModel = (result === null || !result.$isSaved());
        var lazyLoad = db.hasLoad( Load.Lazy );

        if ( lazyLoad && remoteLoaded && missingModel )
        {
          if ( !result )
          {
            result = db.keyHandler.buildObjectFromKey( db.keyHandler.buildKeyFromInput( input ) );
          }

          result.$once( Model.Events.RemoteGets, function()
          {
            if ( !promise.isComplete() )
            {
              if ( isObject( input ) )
              {
                result.$set( input );
              }

              promise.resolve( result.$isSaved() ? result : null );
            }
          });

          result.$refresh( Cascade.All, db.fetchOptions );
        }
        else
        {
          promise.resolve( result );
        }
      }

      return promise.isComplete() ? false : true;
    }

    if ( checkModel() )
    {
      db.ready( checkModel, db, true );
    }

    return promise;
  }
function(input, callback, context, remoteData)
  {
    var db = this;
    var promise = new Promise();

    promise.success( callback, context || db );

    function checkModel()
    {
      var result = db.parseModel( input, remoteData );

      if ( result !== false && !promise.isComplete() && db.initialized )
      {
        var remoteLoaded = db.remoteLoaded || !db.hasLoad( Load.All );
        var missingModel = (result === null || !result.$isSaved());
        var lazyLoad = db.hasLoad( Load.Lazy );

        if ( lazyLoad && remoteLoaded && missingModel )
        {
          if ( !result )
          {
            result = db.keyHandler.buildObjectFromKey( db.keyHandler.buildKeyFromInput( input ) );
          }

          result.$once( Model.Events.RemoteGets, function()
          {
            if ( !promise.isComplete() )
            {
              if ( isObject( input ) )
              {
                result.$set( input );
              }

              promise.resolve( result.$isSaved() ? result : null );
            }
          });

          result.$refresh( Cascade.All, db.fetchOptions );
        }
        else
        {
          promise.resolve( result );
        }
      }

      return promise.isComplete() ? false : true;
    }

    if ( checkModel() )
    {
      db.ready( checkModel, db, true );
    }

    return promise;
  }
function ( input , callback , context , remoteData ) { var db = this ; var promise = new Promise ( ) ; promise . success ( callback , context || db ) ; function checkModel ( ) { var result = db . parseModel ( input , remoteData ) ; if ( result !== false && ! promise . isComplete ( ) && db . initialized ) { var remoteLoaded = db . remoteLoaded || ! db . hasLoad ( Load . All ) ; var missingModel = ( result === null || ! result . $isSaved ( ) ) ; var lazyLoad = db . hasLoad ( Load . Lazy ) ; if ( lazyLoad && remoteLoaded && missingModel ) { if ( ! result ) { result = db . keyHandler . buildObjectFromKey ( db . keyHandler . buildKeyFromInput ( input ) ) ; } result . $once ( Model . Events . RemoteGets , function ( ) { if ( ! promise . isComplete ( ) ) { if ( isObject ( input ) ) { result . $set ( input ) ; } promise . resolve ( result . $isSaved ( ) ? result : null ) ; } } ) ; result . $refresh ( Cascade . All , db . fetchOptions ) ; } else { promise . resolve ( result ) ; } } return promise . isComplete ( ) ? false : true ; } if ( checkModel ( ) ) { db . ready ( checkModel , db , true ) ; } return promise ; }
Grab a model with the given input and notify the callback
Grab a model with the given input and notify the callback