Sha256: e8f10a6127028e58c8c4da1c55d938c6c37664a3faa6abfcaab81fd0161b0112
Contents?: true
Size: 662 Bytes
Versions: 24
Compression:
Stored size: 662 Bytes
Contents
module Avo module Fields module Concerns module IsRequired extend ActiveSupport::Concern def is_required? return required_from_validators if required.nil? Avo::ExecutionContext.new(target: required, record: record, view: view, resource: resource).handle end private def required_from_validators return false unless record.present? validators.any? do |validator| validator.is_a? ActiveModel::Validations::PresenceValidator end end def validators record.class.validators_on(id) end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems