lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb
# Render a corresponding input field for the given attribute.
# The input field is chosen based on the ActiveRecord column type.
# Use additional html_options for the input element.
Render a corresponding input field for the given attribute.
The input field is chosen based on the ActiveRecord column type.
Use additional html_options for the input element.
Render a corresponding input field for the given attribute . The input field is chosen based on the ActiveRecord column type . Use additional html_options for the input element .
def input_field(attr, html_options = {})
    type = column_type(@object, attr)
    if type == :text
      text_area(attr, html_options)
    elsif association_kind?(attr, type, :belongs_to)
      belongs_to_field(attr, html_options)
    elsif association_kind?(attr, type, :has_and_belongs_to_many, :has_many)
      has_many_field(attr, html_options)
    elsif attr.to_s.include?('password')
      password_field(attr, html_options)
    else
      custom_field_method = :"#{type}_field"
      if respond_to?(custom_field_method)
        send(custom_field_method, attr, html_options)
      else
        text_field(attr, html_options)
      end
    end
  end
def input_field ( attr , html_options = { } ) type = column_type ( @object , attr ) if type == :text text_area ( attr , html_options ) elsif association_kind? ( attr , type , :belongs_to ) belongs_to_field ( attr , html_options ) elsif association_kind? ( attr , type , :has_and_belongs_to_many , :has_many ) has_many_field ( attr , html_options ) elsif attr . to_s . include? ( 'password' ) password_field ( attr , html_options ) else custom_field_method = :" #{ type } _field " if respond_to? ( custom_field_method ) send ( custom_field_method , attr , html_options ) else text_field ( attr , html_options ) end end end
Render a corresponding input field for the given attribute.
Render a corresponding input field for the given attribute .
attr
html_options