diff options
author | Jeffrey Hardy <packagethief@gmail.com> | 2009-03-06 17:43:00 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-08 15:20:23 +0000 |
commit | 96eaeee4467a03cba3c4c30aeb6fc6afe545ae1d (patch) | |
tree | a7c49e151729dce8121082209c640623a63a8fb7 /activerecord/lib/active_record | |
parent | 7a26a67b42bdabd89f3685945009ffe99a6d6162 (diff) | |
download | rails-96eaeee4467a03cba3c4c30aeb6fc6afe545ae1d.tar.gz rails-96eaeee4467a03cba3c4c30aeb6fc6afe545ae1d.tar.bz2 rails-96eaeee4467a03cba3c4c30aeb6fc6afe545ae1d.zip |
Add ActiveRecord::Base#invalid? as the opposite of #valid? [#2159 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/validations.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 4453047daf..ba60180ae0 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -1040,6 +1040,11 @@ module ActiveRecord errors.empty? end + # Performs the opposite of <tt>valid?</tt>. Returns true if errors were added, false otherwise. + def invalid? + !valid? + end + # Returns the Errors object that holds all information about attribute error messages. def errors @errors ||= Errors.new(self) |