Class: SimpleForm::PlaceholderFormBuilder

Inherits:
DefaultFormBuilder show all
Defined in:
lib/simple_form/placeholder_form_builder.rb

Direct Known Subclasses

InlineFormBuilder

Constant Summary

Constants inherited from DefaultFormBuilder

DefaultFormBuilder::CHECKBOX_WRAPPER, DefaultFormBuilder::RADIO_WRAPPER

Instance Method Summary collapse

Methods inherited from DefaultFormBuilder

#checkbox, #collection_check_boxes, #collection_radio_buttons, #radio

Instance Method Details

#input(attribute_name, options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/simple_form/placeholder_form_builder.rb', line 3

def input(attribute_name, options = {}, &block)
  if options[:placeholder].nil?
    options[:placeholder] ||= object.class.respond_to?(:human_attribute_name) ?
      object.class.human_attribute_name(attribute_name.to_s) : attribute_name.to_s.humanize
  end
  options[:label] = false if options[:label].nil?

  super
end