Module: ClientSideValidations::SimpleForm::FormBuilder

Defined in:
lib/client_side_validations/simple_form/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#client_side_form_settings(options, _form_helper) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/client_side_validations/simple_form/form_builder.rb', line 6

def client_side_form_settings(options, _form_helper)
  {
    type:                self.class.name,
    error_class:         wrapper_error_component.defaults[:class].join(' '),
    error_tag:           wrapper_error_component.defaults[:tag],
    wrapper_error_class: wrapper.defaults[:error_class],
    wrapper_tag:         wrapper.defaults[:tag],
    wrapper_class:       wrapper.defaults[:class].join(' '),
    wrapper:             options[:wrapper] || ::SimpleForm.default_wrapper
  }
end

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



18
19
20
21
22
23
24
25
26
# File 'lib/client_side_validations/simple_form/form_builder.rb', line 18

def input(attribute_name, options = {}, &block)
  if options.key?(:validate)
    options[:input_html] ||= {}
    options[:input_html][:validate] = options[:validate]
    options.delete(:validate)
  end

  super(attribute_name, options, &block)
end