lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb
# Returns true if the given attribute must be present.
Returns true if the given attribute must be present.
Returns true if the given attribute must be present .
def required?(attr)
    attr = attr.to_s
    attr, attr_id = assoc_and_id_attr(attr)
    validators = @object.class.validators_on(attr) +
                 @object.class.validators_on(attr_id)
    validators.any? do |v|
      v.kind == :presence &&
      !v.options.key?(:if) && !v.options.key?(:unless)
    end
  end
def required? ( attr ) attr = attr . to_s attr , attr_id = assoc_and_id_attr ( attr ) validators = @object . class . validators_on ( attr ) + @object . class . validators_on ( attr_id ) validators . any? do | v | v . kind == :presence && ! v . options . key? ( :if ) && ! v . options . key? ( :unless ) end end
Returns true if the given attribute must be present.
Returns true if the given attribute must be present .
attr