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, #get_class_of, #get_reflection, #get_self_object, #get_type_and_name_of_association, #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



93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/slim_form_object/form_helpers/extension_actionview.rb', line 93

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