Sha256: 767bdf3dccafd4c86e92c40a04ab6db0be4e625b5dcd348285c5462ca824f544
Contents?: true
Size: 852 Bytes
Versions: 30
Compression:
Stored size: 852 Bytes
Contents
var associationable, composed, stampit; stampit = require('../../../vendor/stampit'); associationable = stampit({ validate_each: function(record, attribute, value) { var associated_validation; if (record[attribute]) { if (model[record.resource].has_one.indexOf(attribute) === -1) { throw new Error('Only has_one associations are supported to validates_associated'); } associated_validation = record[attribute].validate(); associated_validation.done(function() { if (record[attribute].errors.length) { return record.errors.add(attribute, 'associated', this.options); } }); return associated_validation; } } }); composed = stampit.compose(require('./validatorable'), associationable); composed.definition_key = 'validates_associated'; module.exports = composed;
Version data entries
30 entries across 30 versions & 1 rubygems