app/views/authors/select.html.erb
<h1 class="entry-title">Select an Author</h1>
<div class="entry-content">
Please select one (or more) authors for <span class='work_title'><strong><%= @work.title %></strong></span> from the following list:
<%= form_for(@author, url: select_roles_url) do |f| %>
<%= f.hidden_field(:work, { value: @work.to_param, name: 'role[work_id]' }) %>
<div class="field">
<%= f.label :author %>
<%= f.collection_select(:id, @all_authors, :to_param, :full_name, {}, { multiple: 'multiple', name: 'role[authors_attributes][][id]' }) %>
</div>
<div class="actions">
<%= f.submit('Confirm selection') %>
</div>
<% end %>
</div>
Or create more authors as needed:<br />
<%= link_to 'Add new author', new_work_author_path(@work), class:"btn" %>