Permalink
Browse files

Making is invalid compatible with Rails

  • Loading branch information...
bermi committed Jan 2, 2011
1 parent 9fa0693 commit a5e981fe534f2f37bfa955bf9656ac31a4c783d3
Showing with 5 additions and 1 deletion.
  1. +5 −1 active_support/models/errors.php
@@ -111,8 +111,12 @@ public function addErrorOnBoundryBreaking ($attributes, $range_begin, $range_end
/**
* @return bool Returns true if the specified $attribute has errors associated with it.
+ * If no attribute is given returns true if errors were added to the model.
*/
- public function isInvalid($attribute) {
+ public function isInvalid($attribute = null) {
+ if($attribute == null){
+ return !$this->_Model->isValid();
+ }
return $this->getErrorsOn($attribute);
}

0 comments on commit a5e981f

Please sign in to comment.