instance method
save_with_validation!
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
save_with_validation!()
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.
Source
# File activerecord/lib/active_record/validations.rb, line 1017
def save_with_validation!
if valid?
save_without_validation!
else
raise RecordInvalid.new(self)
end
end
Defined in activerecord/lib/active_record/validations.rb line 1017
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Validations