instance method save_with_validation!

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available 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 1097
    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 1097 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Validations

Type at least 2 characters to search.

↑↓ navigate · open · esc close