Sha256: c2d90416cdeddde10c243d83dd062230e39e63623c3a9a3879182e63bafe83b2

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

module Bootstrap4FormBuilder
  module Helper
    
    def bootstrap_form_for(object, options= {}, &block)
      options.reverse_merge!({builder: Bootstrap4FormBuilder::FormBuilder::BootstrapBuilder})
      
      options[:html] ||= {}
      options[:html][:role] ||= "form"
      
      #Done in Builder
      # if options[:layout] == :inline
      #   options[:html][:class] = [options[:html][:class], "form-inline"].compact.join(" ")
      # end
      
      #Done in Builder
      #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

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap4_form_builder-0.0.1 lib/bootstrap4_form_builder/helper.rb