module EnumHelp::SimpleForm::BuilderExtension
Public Instance Methods
default_input_type(*args, &block)
click to toggle source
Calls superclass method
# File lib/enum_help/simple_form.rb, line 7 def default_input_type(*args, &block) att_name = (args.first || @attribute_name).to_s options = args.last return :enum_radio_buttons if options.is_a?(Hash) && options[:as] == :radio_buttons && is_enum_attributes?( att_name ) return :enum if (options.is_a?(Hash) ? options[:as] : @options[:as]).nil? && is_enum_attributes?( att_name ) super end
is_enum_attributes?( attribute_name )
click to toggle source
# File lib/enum_help/simple_form.rb, line 20 def is_enum_attributes?( attribute_name ) object.class.respond_to?(:defined_enums) && object.class.defined_enums.key?(attribute_name) && attribute_name.pluralize != "references" end