Class: Formatic::Wrappers::Required

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/formatic/wrappers/required.rb

Overview

Determines whether an attributes is optional or not.

Instance Method Summary collapse

Instance Method Details

#callObject

Could also be made smarter, e.g. global configuration. See github.com/heartcombo/simple_form/blob/main/lib/simple_form/helpers/required.rb



15
16
17
18
19
20
21
# File 'lib/formatic/wrappers/required.rb', line 15

def call
  return true if manual_required == true
  return false if manual_required == false
  return false if validators.empty?

  validators.any? { applicable?(it) }
end