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
27
28
# 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)

  options = process_options(options)

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

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



40
41
42
43
44
# File 'lib/bootstrap_form/action_view_extensions/form_helper.rb', line 40

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

  bootstrap_form_for("", options, &block)
end

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



30
31
32
33
34
35
36
37
38
# File 'lib/bootstrap_form/action_view_extensions/form_helper.rb', line 30

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

  options = process_options(options)

  with_bootstrap_form_field_error_proc do
    form_with(options, &block)
  end
end