Module: MNE::TwitterBootstrapFormBuilder::Helper

Defined in:
lib/twitter-bootstrap-form-builder/helper.rb

Instance Method Summary collapse

Instance Method Details

#form_for(record, options = {}, &proc) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/twitter-bootstrap-form-builder/helper.rb', line 5

def form_for (record, options = {}, &proc)
  return super(record, options, &proc) if options.delete(:bootstrap) === false

  options[:builder] ||= MNE::TwitterBootstrapFormBuilder::FormBuilder
  options[:html] ||= {}
  options[:html][:class] ||= ""

  if !options[:html][:class].match(/form-(horizontal|vertical)/)
    options[:html][:class] = ["form-horizontal", options[:html][:class]].join(" ")
  end

  super(record, options, &proc)
end