module TemplateForm::FormHelper

Public Instance Methods

template_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block) click to toggle source
# File lib/template_form/form_helper.rb, line 6
def template_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
  options[:builder] = TemplateForm::FormBuilder

  with_template_form_field_error_proc do
    form_with model: model, scope: scope, url: url, format: format, **options, &block
  end
end

Private Instance Methods

with_template_form_field_error_proc() { || ... } click to toggle source
# File lib/template_form/form_helper.rb, line 16
def with_template_form_field_error_proc
  default_field_error_proc = ActionView::Base.field_error_proc
  begin
    ActionView::Base.field_error_proc = TemplateForm.field_error_proc
    yield
  ensure
    ActionView::Base.field_error_proc = default_field_error_proc
  end
end