class ActiveRecord::RecordNotSaved
Product.create! # => raises an ActiveRecord::RecordNotSaved
end
end
throw :abort if price < 0
before_save do
class Product < ActiveRecord::Base
ActiveRecord::Callbacks for further details.before_*
callbacks throwing :abort
. See
methods when a record failed to validate or cannot be saved due to any of the
Raised by ActiveRecord::Base#save! and
def initialize(message = nil, record = nil)
def initialize(message = nil, record = nil) @record = record super(message) end