Class: ActionView::Helpers::DateTimeSelector

Inherits:
Object
  • Object
show all
Includes:
HelperMethods
Defined in:
lib/slim_form_object/form_helpers/extension_actionview.rb

Overview

EXTENSIONS

Instance Method Summary collapse

Methods included from HelperMethods

#assignment_to_each_other, #class_name_if_module, #define_classes_array_with_name, #get_class_of, #get_reflection, #get_self_object, #get_type_and_name_of_association, #iterate_parents_with_nested_objects, #make_constant_name, #method_name_association, #snake, #to_bind_models, #type_and_name_of_association_back_and_forth, #type_association

Instance Method Details

#input_name_from_type(type) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/slim_form_object/form_helpers/extension_actionview.rb', line 66

def input_name_from_type(type)
  prefix = @options[:prefix] || ActionView::Helpers::DateTimeSelector::DEFAULT_PREFIX
  prefix += "[#{@options[:index]}]" if @options.has_key?(:index)

  field_name = @options[:field_name] || type
  if @options[:include_position]
    field_name += "(#{ActionView::Helpers::DateTimeSelector::POSITION[type]}i)"
  end
  options = self.instance_variable_get(:@options)
  return sfo_get_date_tag_name(prefix, field_name, options) if sfo_date_attr?(field_name)

  @options[:discard_type] ? prefix : "#{prefix}[#{field_name}]"
end