<%= bootstrap_form_for(@course.course_participations.build, html: { class: "form-inline" }) do |f| %> <%= render 'shared/error_messages', object: f.object %> <%= f.hidden_field :course_id, value: @course.id %> <%= f.select :role, collection: CourseParticipation.roles.keys.to_a %> <%= f.select :user_id, options_for_select(User.where.not(id: @course.users.map(&:id)).map{ |user| [user.name, user.id] }) %> <%= f.submit "Add user", class: "btn btn-primary" %> <% end %>