module Formulate::FormHelper
Constants
- FIELD_ERROR_PROC
Public Instance Methods
form_for(record, options={}, &proc)
click to toggle source
Calls superclass method
# File lib/formulate/form_helper.rb, line 5 def form_for(record, options={}, &proc) options[:html] ||= {} options[:builder] ||= FormBuilder case record when String, Symbol options[:html][:class] ||= '' else object = record.is_a?(Array) ? record.last : record raise ArgumentError, 'First argument in form cannot contain nil or be empty' unless object apply_form_for_options!(record, object, options) end options[:html][:class] << ' formulate' options[:html][:class] << " #{options[:class]}" if options[:class] options[:html][:class].strip! original_field_error_proc = ::ActionView::Base.field_error_proc ::ActionView::Base.field_error_proc = FIELD_ERROR_PROC super ensure ::ActionView::Base.field_error_proc = original_field_error_proc end