{"action":"created","issue":{"url":"https://api.github.com/repos/offirgolan/ember-cp-validations/issues/124","repository_url":"https://api.github.com/repos/offirgolan/ember-cp-validations","labels_url":"https://api.github.com/repos/offirgolan/ember-cp-validations/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/offirgolan/ember-cp-validations/issues/124/comments","events_url":"https://api.github.com/repos/offirgolan/ember-cp-validations/issues/124/events","html_url":"https://github.com/offirgolan/ember-cp-validations/issues/124","id":134661213,"number":124,"title":"Validate on runs validation on all attributes","user":{"login":"kat3kasper","id":1551316,"avatar_url":"https://avatars.githubusercontent.com/u/1551316?v=3","gravatar_id":"","url":"https://api.github.com/users/kat3kasper","html_url":"https://github.com/kat3kasper","followers_url":"https://api.github.com/users/kat3kasper/followers","following_url":"https://api.github.com/users/kat3kasper/following{/other_user}","gists_url":"https://api.github.com/users/kat3kasper/gists{/gist_id}","starred_url":"https://api.github.com/users/kat3kasper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kat3kasper/subscriptions","organizations_url":"https://api.github.com/users/kat3kasper/orgs","repos_url":"https://api.github.com/users/kat3kasper/repos","events_url":"https://api.github.com/users/kat3kasper/events{/privacy}","received_events_url":"https://api.github.com/users/kat3kasper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-18T18:47:58Z","updated_at":"2016-02-18T19:34:01Z","closed_at":null,"body":"I'm wondering why when using `on` during validate, validate still validates each attr and only stores the results of those whitelisted. This seems like unnecessary processing. Why not only run the validation if on is not defined or the attr is specified. \r\n\r\n```js\r\nfunction validate(options = {}, async = true) {\r\n  var model = get(this, 'model');\r\n  var whiteList = makeArray(options.on);\r\n  var blackList = makeArray(options.excludes);\r\n  var validationResult, value;\r\n \r\n  var validationResults = get(this, '_validatableAttributes').reduce((v, name) => {\r\n    \r\n    if (!isEmpty(blackList) && blackList.indexOf(name) !== -1) {\r\n      return v;\r\n    }\r\n \r\n    if (isEmpty(whiteList) || whiteList.indexOf(name) !== -1) {\r\n      validationResult = get(this, `attrs.${name}`);\r\n\r\n     // If an async validation is found, throw an error\r\n     if (!async && get(validationResult, 'isAsync')) {\r\n       throw new Error(`[ember-cp-validations] Synchronous validation failed due to ${name} being an async validation.`);\r\n     }\r\n\r\n      value = get(validationResult, 'value');\r\n      v.push(validationResult);\r\n    }\r\n    return v;\r\n  }, []);\r\n \r\n  var validationResultsCollection = ValidationResultCollection.create({\r\n    content: validationResults\r\n  });\r\n \r\n  var resultObject = {\r\n    model,\r\n    validations: validationResultsCollection\r\n  };\r\n \r\n  if (async) {\r\n    if (get(validationResultsCollection, 'isAsync')) {\r\n      resultObject.promise = get(validationResultsCollection, 'value');\r\n    }\r\n    return RSVP.hash(resultObject);\r\n  }\r\n \r\n  return resultObject;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/offirgolan/ember-cp-validations/issues/comments/185882174","html_url":"https://github.com/offirgolan/ember-cp-validations/issues/124#issuecomment-185882174","issue_url":"https://api.github.com/repos/offirgolan/ember-cp-validations/issues/124","id":185882174,"user":{"login":"offirgolan","id":575938,"avatar_url":"https://avatars.githubusercontent.com/u/575938?v=3","gravatar_id":"","url":"https://api.github.com/users/offirgolan","html_url":"https://github.com/offirgolan","followers_url":"https://api.github.com/users/offirgolan/followers","following_url":"https://api.github.com/users/offirgolan/following{/other_user}","gists_url":"https://api.github.com/users/offirgolan/gists{/gist_id}","starred_url":"https://api.github.com/users/offirgolan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/offirgolan/subscriptions","organizations_url":"https://api.github.com/users/offirgolan/orgs","repos_url":"https://api.github.com/users/offirgolan/repos","events_url":"https://api.github.com/users/offirgolan/events{/privacy}","received_events_url":"https://api.github.com/users/offirgolan/received_events","type":"User","site_admin":false},"created_at":"2016-02-18T19:34:01Z","updated_at":"2016-02-18T19:34:01Z","body":"Im not sure I'm understanding you question but if `on` is provided, we only validate the attributes that are given in that collection\r\n\r\n```js\r\n if (isEmpty(whiteList) || whiteList.indexOf(name) !== -1) { ... }\r\n```"}}