aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/validations.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/validations.rb')
-rw-r--r--activerecord/lib/active_record/validations.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index 8b266be638..b2ee51fa51 100644
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -74,7 +74,7 @@ module ActiveRecord
def valid?
errors.clear
- @_on_validate = new_record? ? :create : :update
+ self.validation_context = new_record? ? :create : :update
_run_validate_callbacks
deprecated_callback_method(:validate)
@@ -87,6 +87,10 @@ module ActiveRecord
errors.empty?
end
+
+ def invalid?
+ !valid?
+ end
end
end
end