Method: Satis::Forms::Builder#input_type_for

Defined in:
lib/satis/forms/builder.rb

#input_type_for(method, options) ⇒ Object

Non public



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/satis/forms/builder.rb', line 161

def input_type_for(method, options)
  object_type = object_type_for_method(method)
  input_type = case object_type
  when :date then :date_time
  when :datetime then :date_time
  when :integer then :string
  when :float then :string
  else object_type
  end
  override_input_type = if options[:as]
    options[:as]
  elsif options[:collection]
    :select
  elsif options[:url]
    :dropdown
  end

  "#{override_input_type || input_type}_input"
end