Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RemiDuvoux/aa53dd5610a12d850deca44a2e5db100 to your computer and use it in GitHub Desktop.
Save RemiDuvoux/aa53dd5610a12d850deca44a2e5db100 to your computer and use it in GitHub Desktop.
Using simple_form on a collection of Users.
I need the dropdown to show the name and surname of the Users (not only the name) + the id in value.
This works 👇
<%= t.input :traveller, :collection => Proc.new{ @team_users.map{ |p| ["#{p.name} #{p.surname}", p.id] } }, label: false, selected: current_user.id %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment