Class: SimpleForm::DefaultFormBuilder
- Inherits:
-
FormBuilder
- Object
- FormBuilder
- SimpleForm::DefaultFormBuilder
show all
- Defined in:
- lib/simple_form/default_form_builder.rb
Constant Summary
collapse
- CHECKBOX_WRAPPER =
:checkbox
- RADIO_WRAPPER =
:radio
Instance Method Summary
collapse
Instance Method Details
#checkbox(attribute_name, options = {}, &block) ⇒ Object
9
10
11
12
13
|
# File 'lib/simple_form/default_form_builder.rb', line 9
def checkbox(attribute_name, options = {}, &block)
options[:wrapper] ||= self.class::CHECKBOX_WRAPPER
options[:as] ||= :boolean
input attribute_name, options, &block
end
|
20
21
22
23
|
# File 'lib/simple_form/default_form_builder.rb', line 20
def input(attribute_name, options = {}, &block)
options[:wrapper] ||= self.class::CHECKBOX_WRAPPER if options[:as] == :boolean
super
end
|
#radio(attribute_name, options = {}, &block) ⇒ Object
15
16
17
18
|
# File 'lib/simple_form/default_form_builder.rb', line 15
def radio(attribute_name, options = {}, &block)
options[:wrapper] ||= self.class::RADIO_WRAPPER
input attribute_name, options, &block
end
|