Method: Manageable::Helpers::FormBuilder#select

Defined in:
lib/manageable/helpers/form_builder.rb

#select(method, choices, options = {}, html_options = {}) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/manageable/helpers/form_builder.rb', line 68

def select(method, choices, options = {}, html_options = {})
  unless options[:label] == false
    description_tag = @template.(:span, options.delete(:description), :class => "description") if options[:description].present?
    label_tag       = field_label(method, options.delete(:label), extract_options(:label_class, options))
    field_tag       = super(method, choices, options, html_options)

    # Applies fieldWithErrors
    label_tag = @@field_with_errors_proc.call(method, label_tag, @object, @template)

    group(extract_options(:group_class, options)) do
      (label_tag + field_tag + description_tag).html_safe
    end
  else
    super(method, choices, options, html_options)
  end
end