Class: Hyrax::FormFactory

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/form_factory.rb

Overview

Note:

We use a factory class (rather than a factory method like `.for`) to provide compatibility with the legacy `Hyrax::WorkFormService`.

A factory class for Hyrax forms.

Examples:

factory = Hyrax::FormFactory.new

form_change_set = factory.build(work)

Since:

  • 3.0.0

Instance Method Summary collapse

Instance Method Details

#build(model, _ability, _controller) ⇒ Object

Builds and prepopulates a form for the given model.

Parameters:

  • model (Object)
  • ability (Hyrax::Ability)
  • controller (ApplicationController)

See Also:

Since:

  • 3.0.0


25
26
27
# File 'app/services/hyrax/form_factory.rb', line 25

def build(model, _ability, _controller)
  Hyrax::Forms::ResourceForm.for(model).prepopulate!
end