Sha256: 5c9277d02aff084749ad5d2cc3288b90f9db3c1cea4a3495cbab89c503f0431d
Contents?: true
Size: 776 Bytes
Versions: 9
Compression:
Stored size: 776 Bytes
Contents
module BootstrapForm module Helper def bootstrap_form_for(object, options = {}, &block) options[:builder] = BootstrapForm::FormBuilder # add .form-vertical class if it's not horizontal options[:html] = {} unless options.has_key?(:html) css = options[:html].fetch(:class, '') options[:html][:class] = "#{css} form-vertical" unless css.match /form-horizontal/ temporarily_disable_field_error_proc do form_for(object, options, &block) end end def temporarily_disable_field_error_proc original_proc = ActionView::Base.field_error_proc ActionView::Base.field_error_proc = proc { |input, instance| input } yield ensure ActionView::Base.field_error_proc = original_proc end end end
Version data entries
9 entries across 9 versions & 1 rubygems