Module: Hyrax::FlexibleFormBehavior

Extended by:
ActiveSupport::Concern
Defined in:
app/forms/concerns/hyrax/flexible_form_behavior.rb

Instance Method Summary collapse

Instance Method Details

#schemaObject

OVERRIDE disposable 0.6.3 to make schema dynamic



22
23
24
# File 'app/forms/concerns/hyrax/flexible_form_behavior.rb', line 22

def schema
  Hyrax::Forms::ResourceForm::Definition::Each.new(singleton_class.schema_definitions)
end

#validate_flexible_required_fieldsObject



12
13
14
15
16
17
18
19
# File 'app/forms/concerns/hyrax/flexible_form_behavior.rb', line 12

def validate_flexible_required_fields
  required_fields = singleton_class.schema_definitions.select { |_, opts| opts[:required] }.keys

  required_fields.each do |field|
    value = send(field)
    errors.add(field, :blank) if value.blank?
  end
end