Sha256: d67a2c9e936e6fd97b5ba279940041c0185a38f4cd7adb69cc873acb6c5afd4f
Contents?: true
Size: 460 Bytes
Versions: 8
Compression:
Stored size: 460 Bytes
Contents
module PhModel module Concerns module AttributeRequiredValidation extend ActiveSupport::Concern included do |other| other.validate :validate_required_attributes end def validate_required_attributes self.class.attributes.each do |attribute_name, info| if info[:required] && send(attribute_name).blank? errors.add(attribute_name, :empty) end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems