Skip to content

Instantly share code, notes, and snippets.

@alexparker
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexparker/f5cc2947c2303f54d32e to your computer and use it in GitHub Desktop.
Save alexparker/f5cc2947c2303f54d32e to your computer and use it in GitHub Desktop.
model.eachAttribute(function(name, meta) {
var methodName = name + "Valid";
var errorsKey = "errors." + name;
var method = function() {
var isValid = Ember.isEmpty(this.get(errorsKey));
if (isValid) {
return 'valid';
} else {
return 'input--error';
}
}.property(errorsKey)
_this.set(methodName, method);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment