<%= form_for @device, html: { class: 'form-horizontal' } do |f| %> <%= render 'object_errors', object: f.object %> <%= form_group f, :name, :text_field %>
<%= f.label :driver, class: 'col-sm-2 control-label' %>
<% if @device.driveable.present? %>

<%= link_to '#', class: 'btn btn-danger btn-sm pull-right' do %> <%= t('.change_driver') %> <% end %> <%= @device.driveable.class::NAME %>

<% else %> <%= f.select :driver, options_for_drivers, { include_blank: true }, class: 'form-control' %> <% end %>
<%= fields_for :driveable do |fd| %> <%= driver_settings fd, @device.driveable %> <%= fields_for :serial_config do |fds| %>
<%= render 'extface/serial_configs/settings', f: fds %>
<% end if @device.driveable.serial? %> <% end if @device.driveable.present? %> <% end %>