class ActiveRecord::RecordNotSaved
Raised by ActiveRecord::Base#save! and ActiveRecord::Base.update_attribute! methods when a record failed to validate or cannot be saved due to any of the before_*
callbacks throwing :abort
. See ActiveRecord::Callbacks
for further details.
class Product < ActiveRecord::Base before_save do throw :abort if price < 0 end end Product.create! # => raises an ActiveRecord::RecordNotSaved
Attributes
Public Class Methods
Calls superclass method
# File activerecord/lib/active_record/errors.rb, line 164 def initialize(message = nil, record = nil) @record = record super(message) end