lib/rails_devs_for_data_integrity.rb
def save_with_data_integrity_check!(*args)
    save_without_data_integrity_check!(*args)
  rescue ActiveRecord::RecordNotSaved => e
    raise ActiveRecord::RecordInvalid.new(self) if @duplicate_exception||@foreign_key_exception
    raise e
  end
# save! with data integrity check
# RecordNotSaved will be thrown by save! before converting to the standard
# validation error ActiveRecord::RecordInvalid
save. with data integrity check
RecordNotSaved will be thrown by save. before converting to the standard
validation error ActiveRecord::RecordInvalid
save . with data integrity check RecordNotSaved will be thrown by save . before converting to the standard validation error ActiveRecord :: RecordInvalid
def save_with_data_integrity_check!(*args)
    save_without_data_integrity_check!(*args)
  rescue ActiveRecord::RecordNotSaved => e
    raise ActiveRecord::RecordInvalid.new(self) if @duplicate_exception||@foreign_key_exception
    raise e
  end
def save_with_data_integrity_check! ( * args ) save_without_data_integrity_check! ( * args ) rescue ActiveRecord :: RecordNotSaved => e raise ActiveRecord :: RecordInvalid . new ( self ) if @duplicate_exception || @foreign_key_exception raise e end
save!
save!
args