Module: CaseForm::FormHelper

Defined in:
lib/case_form/core_ext/form_helper.rb

Constant Summary collapse

FIELD_ERROR_PROC =

Override the default ActiveRecordHelper behaviour of wrapping the input. This gets taken care of semantically by adding an error class to the wrapper tag containing the input.

proc do |html_tag, instance_tag|
  html_tag
end
@@default_field_error_proc =
nil

Instance Method Summary collapse

Instance Method Details

#with_custom_field_error_proc(&block) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/case_form/core_ext/form_helper.rb', line 12

def with_custom_field_error_proc(&block)
  @@default_field_error_proc = ::ActionView::Base.field_error_proc
  ::ActionView::Base.field_error_proc = FIELD_ERROR_PROC
  result = yield
  ::ActionView::Base.field_error_proc = @@default_field_error_proc
  result
end