dist/backbone-validation.js
function(view, options) {
        options = _.extend({}, defaultOptions, defaultCallbacks, options);

        var model = options.model || view.model,
            collection = options.collection || view.collection;

        if(typeof model === 'undefined' && typeof collection === 'undefined'){
          throw 'Before you execute the binding your view must have a model or a collection.\n' +
                'See http://thedersen.com/projects/backbone-validation/#using-form-model-validation for more information.';
        }

        if(model) {
          bindModel(view, model, options);
        }
        else if(collection) {
          collection.each(function(model){
            bindModel(view, model, options);
          });
          collection.bind('add', collectionAdd, {view: view, options: options});
          collection.bind('remove', collectionRemove);
        }
      }
function(view, options) {
        options = _.extend({}, defaultOptions, defaultCallbacks, options);

        var model = options.model || view.model,
            collection = options.collection || view.collection;

        if(typeof model === 'undefined' && typeof collection === 'undefined'){
          throw 'Before you execute the binding your view must have a model or a collection.\n' +
                'See http://thedersen.com/projects/backbone-validation/#using-form-model-validation for more information.';
        }

        if(model) {
          bindModel(view, model, options);
        }
        else if(collection) {
          collection.each(function(model){
            bindModel(view, model, options);
          });
          collection.bind('add', collectionAdd, {view: view, options: options});
          collection.bind('remove', collectionRemove);
        }
      }
function ( view , options ) { options = _ . extend ( { } , defaultOptions , defaultCallbacks , options ) ; var model = options . model || view . model , collection = options . collection || view . collection ; if ( typeof model === 'undefined' && typeof collection === 'undefined' ) { throw 'Before you execute the binding your view must have a model or a collection.\n' + 'See http://thedersen.com/projects/backbone-validation/#using-form-model-validation for more information.' ; } if ( model ) { bindModel ( view , model , options ) ; } else if ( collection ) { collection . each ( function ( model ) { bindModel ( view , model , options ) ; } ) ; collection . bind ( 'add' , collectionAdd , { view : view , options : options } ) ; collection . bind ( 'remove' , collectionRemove ) ; } }
Hooks up validation on a view with a model or collection
Hooks up validation on a view with a model or collection