This way is working perfectly fine for me:
<%= f.input :unit_name,
collection: @units.map { |u| [u, u] },
as: :select,
input_html: { class: 'select2' },
prompt: 'prompt'
%>
'input_html: { class: 'select2' }' Line is making the select2 work