Sha256: 79ac27941dd996a99a89104865af31e8c7ca6a4ee5a7ff28fca8b2531c025505
Contents?: true
Size: 525 Bytes
Versions: 6
Compression:
Stored size: 525 Bytes
Contents
module Copyable class Saver # this is the algorithm for saving the new record def self.save!(new_model, skip_validations) unless skip_validations ModelHooks.reenable!(new_model.class) # we must re-enable or validation does not work if !new_model.valid?(:create) ModelHooks.disable!(new_model.class) raise(ActiveRecord::RecordInvalid.new(new_model)) else ModelHooks.disable!(new_model.class) end end new_model.save! end end end
Version data entries
6 entries across 6 versions & 1 rubygems