Sha256: b6c1acd879ce156f7f4d10329fe1442de8bb3f24783b6ab1a3e35f8b994199f7
Contents?: true
Size: 598 Bytes
Versions: 8
Compression:
Stored size: 598 Bytes
Contents
module SuperModel module Validations extend ActiveSupport::Concern include ActiveModel::Validations included do alias_method_chain :save, :validation end def save_with_validation(options = nil) perform_validation = case options when Hash options[:validate] != false when NilClass true else options end if perform_validation && valid? || !perform_validation save_without_validation true else false end rescue InvalidRecord => error false end end end
Version data entries
8 entries across 8 versions & 1 rubygems