<% model = options[:model] form = options[:form] name = options[:name] group_class_list = [ 'form-group', options[:group_class] ] label_class_list = [ 'control-label', options[:label_class] ] field_class_list = [ 'input-group', options[:field_class] ] input_class_list = [ 'form-control', options[:input_class] ] error_class_list = [ 'text-danger', options[:error_class] ] group_class_list << 'has-error' if model.errors[name].present? group_class = group_class_list.flatten.join ' ' label_class = label_class_list.flatten.join ' ' field_class = field_class_list.flatten.join ' ' input_class = input_class_list.flatten.join ' ' error_class = error_class_list.flatten.join ' ' input_prefix = options[:input_prefix] input_suffix = options[:input_suffix] label_text = options[:label_text] label_prefix = options[:label_prefix] label_suffix = options[:label_suffix] input_options = { class: input_class_list, disabled: options[:disabled] } error_hidden = options[:error_hidden] choices = options[:choices] flags = options[:options]||{} %>
<%= form.label name, class: label_class do %><%= label_prefix %><%= label_text||model.class.human_attribute_name(name.to_sym) %><%= label_suffix %><% end %> <% if input_prefix.present? || input_suffix.present? %>
<% if input_prefix.present? %> <%= input_prefix %> <% end %> <%= form.select name, choices, flags, input_options %> <% if input_suffix.present? %> <%= input_suffix %> <% end %>
<% else %> <%= form.select name, choices, flags, input_options %> <% end %> <% if model.errors[name].present? && !error_hidden %>

<%= model.errors[name].first %>

<% end %>