Sha256: 17cb4362b59500c403ae6f9bf5ea31cb08486c90f3dd934d3b166551711cd04e
Contents?: true
Size: 738 Bytes
Versions: 86
Compression:
Stored size: 738 Bytes
Contents
module Avo module Fields module Concerns module IsRequired extend ActiveSupport::Concern def is_required? if required.respond_to? :call Avo::Hosts::ResourceViewRecordHost.new(block: required, record: model, view: view, resource: resource).handle else required.nil? ? required_from_validators : required end end private def required_from_validators return false if model.nil? validators.any? do |validator| validator.is_a? ActiveModel::Validations::PresenceValidator end end def validators model.class.validators_on(id) end end end end end
Version data entries
86 entries across 86 versions & 1 rubygems