Module: BootstrapForm::ActionViewExtensions::FormHelper

Defined in:
lib/bootstrap_form/action_view_extensions/form_helper.rb

Overview

This module creates BootstrapForm 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



20
21
22
23
24
25
26
# File 'lib/bootstrap_form/action_view_extensions/form_helper.rb', line 20

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

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

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



36
37
38
39
40
# File 'lib/bootstrap_form/action_view_extensions/form_helper.rb', line 36

def bootstrap_form_tag(options={}, &block)
  options[:acts_like_form_tag] = true

  bootstrap_form_for("", options, &block)
end

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



28
29
30
31
32
33
34
# File 'lib/bootstrap_form/action_view_extensions/form_helper.rb', line 28

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

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