class SimpleForm::Inputs::Base
def initialize(builder, attribute_name, column, input_type, options = {})
def initialize(builder, attribute_name, column, input_type, options = {}) super @builder = builder @attribute_name = attribute_name @column = column @input_type = input_type @reflection = options.delete(:reflection) @options = options.reverse_merge!(self.class.default_options) @required = calculate_required # Notice that html_options_for receives a reference to input_html_classes. # This means that classes added dynamically to input_html_classes will # still propagate to input_html_options. @html_classes = SimpleForm.additional_classes_for(:input) { [input_type, required_class, readonly_class, disabled_class].compact } @input_html_classes = @html_classes.dup @input_html_options = html_options_for(:input, input_html_classes).tap do |o| o[:readonly] = true if has_readonly? o[:disabled] = true if has_disabled? o[:autofocus] = true if has_autofocus? end end