Module: RailsBootstrapForm::ActionViewExtensions::BootstrapFormHelper

Defined in:
lib/rails_bootstrap_form/action_view_extensions/bootstrap_form_helper.rb

Overview

This module creates ‘RailsBootstrapForm` wrappers around the default form_with and form_for methods.

Example:

bootstrap_form_for @user do |f|
  f.text_field :name
end

Example:

bootstrap_form_with model: @user do |f|
  f.text_field :name
end

Instance Method Summary collapse

Instance Method Details

#bootstrap_form_for(record, options = {}, &block) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rails_bootstrap_form/action_view_extensions/bootstrap_form_helper.rb', line 23

def bootstrap_form_for(record, options = {}, &block)
  options.reverse_merge!(builder: RailsBootstrapForm::BootstrapFormBuilder)

  supress_form_field_errors do
    form_for(record, options, &block)
  end
end

#bootstrap_form_with(options = {}, &block) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/rails_bootstrap_form/action_view_extensions/bootstrap_form_helper.rb', line 31

def bootstrap_form_with(options = {}, &block)
  options.reverse_merge!(builder: RailsBootstrapForm::BootstrapFormBuilder)

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