Module: EnumHelp::SimpleForm::BuilderExtension

Defined in:
lib/enum_help/simple_form.rb

Instance Method Summary collapse

Instance Method Details

#default_input_type_with_enum(*args, &block) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/enum_help/simple_form.rb', line 7

def default_input_type_with_enum(*args, &block)
  att_name = (args.first || @attribute_name).to_s
  return :enum if (args.last.is_a?(Hash) ? args.last[:as] : @options[:as]).nil? &&
                  object.class.respond_to?(att_name.pluralize)

  default_input_type_without_enum(*args, &block)
end