Class: ValidationAnnotations::FormBuilder

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
lib/validation_annotations/form_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(object_name, object, template, options, proc) ⇒ FormBuilder

Returns a new instance of FormBuilder.



6
7
8
9
# File 'lib/validation_annotations/form_builder.rb', line 6

def initialize(object_name, object, template, options, proc)
  @skip_annotations = !options[:validation_annotations].nil? && options[:validation_annotations] === false
  super(object_name, object, template, options, proc)
end

Instance Method Details

#check_box(method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object



11
12
13
14
# File 'lib/validation_annotations/form_builder.rb', line 11

def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
  options = setup_validation_options(method, options)
  super(method, options, checked_value, unchecked_value)
end

#check_boxes(method, options, &block) ⇒ Object



38
39
40
41
42
43
# File 'lib/validation_annotations/form_builder.rb', line 38

def check_boxes(method, options, &block)
  options = setup_validation_options(method, options)
  options[:class].push("checkboxes") if options[:class].is_a?(Array)

  @template.(:div, options, &block)
end

#password_field(method, options = {}) ⇒ Object



16
17
18
19
# File 'lib/validation_annotations/form_builder.rb', line 16

def password_field(method, options = {})
  options = setup_validation_options(method, options)
  super(method, options)
end

#radio_buttons(method, options, &block) ⇒ Object



31
32
33
34
35
36
# File 'lib/validation_annotations/form_builder.rb', line 31

def radio_buttons(method, options, &block)
  options = setup_validation_options(method, options)
  options[:class].push("radio") if options[:class].is_a?(Array)

  @template.(:div, options, &block)
end

#text_area(method, options = {}) ⇒ Object



21
22
23
24
# File 'lib/validation_annotations/form_builder.rb', line 21

def text_area(method, options = {})
  options = setup_validation_options(method, options)
  super(method, options)
end

#text_field(method, options = {}) ⇒ Object



26
27
28
29
# File 'lib/validation_annotations/form_builder.rb', line 26

def text_field(method, options = {})
  options = setup_validation_options(method, options)
  super(method, options)
end