Sha256: 812ddbf7404d2b3404d9738d514d239f20710cc747795ea9a75ae05a3df2055a
Contents?: true
Size: 640 Bytes
Versions: 5
Compression:
Stored size: 640 Bytes
Contents
module Commons module Concerns module Extensions module Deleted extend ActiveSupport::Concern included do before_validation :check_not_deleted, on: [:update] def deleted? raise ActiveModel::MissingAttributeError unless self.has_attribute?(:deleted_at) self.deleted_at.present? end end private def check_not_deleted raise ActiveModel::MissingAttributeError unless self.has_attribute?(:deleted_at) raise ActiveRecord::RecordInvalid if self.deleted_at_in_database.present? end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems