aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/validations.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb
index 58391168a9..7a6fef0b7b 100644
--- a/activerecord/lib/active_record/validations.rb
+++ b/activerecord/lib/active_record/validations.rb
@@ -37,8 +37,7 @@ module ActiveRecord
# The validation process on save can be skipped by passing false. The regular Base#save method is
# replaced with this when the validations module is mixed in, which it is by default.
def save(options={})
- return super if perform_validations(options)
- false
+ perform_validations(options) ? super : false
end
def save_without_validation!
@@ -48,8 +47,7 @@ module ActiveRecord
# Attempts to save the record just like Base#save but will raise a RecordInvalid exception instead of returning false
# if the record is not valid.
def save!(options={})
- return super if perform_validations(options)
- raise RecordInvalid.new(self)
+ perform_validations(options) ? super : raise(RecordInvalid.new(self))
end
# Runs all the specified validations and returns true if no errors were added otherwise false.