Sha256: 1367b4e1becf58c64caec7b3f82416ea24bb2b48891a2227f07c02177a446010

Contents?: true

Size: 602 Bytes

Versions: 2

Compression:

Stored size: 602 Bytes

Contents

require 'bulma_form_builder/form_builder'

module BulmaFormBuilder
  module FormHelper
    def bulma_form_with(options = {}, &block)
      options.reverse_merge!(builder: ::BulmaFormBuilder::FormBuilder)

      _with_bulma_form_field_error_proc do
        form_with(**options, &block)
      end
    end

    def _with_bulma_form_field_error_proc
      original_proc = ActionView::Base.field_error_proc
      ActionView::Base.field_error_proc = proc do |html_tag, _instance_tag|
        html_tag
      end
      yield
    ensure
      ActionView::Base.field_error_proc = original_proc
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bulma_form_builder-0.4.3 lib/bulma_form_builder/form_helper.rb
bulma_form_builder-0.4.2 lib/bulma_form_builder/form_helper.rb