Sha256: 972b06a2f6e5fa4ea3b96907716e49225dea3784975bc5bf6b1139d4269412a7
Contents?: true
Size: 771 Bytes
Versions: 2
Compression:
Stored size: 771 Bytes
Contents
# frozen_string_literal: true module Micro::Attributes module Features module ActiveModelValidations def self.included(base) begin require 'active_model' base.send(:include, ::ActiveModel::Validations) base.extend(ClassMethods) rescue LoadError end end module ClassMethods def __call_after_attribute_set__(attr_name, options) validate, validates = options.values_at(:validate, :validates) self.validate(validate) if validate self.validates(attr_name, validates) if validates end end private def __call_after_micro_attribute run_validations! if respond_to?(:run_validations!, true) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
u-attributes-2.0.1 | lib/micro/attributes/features/activemodel_validations.rb |
u-attributes-2.0.0 | lib/micro/attributes/features/activemodel_validations.rb |