Skip to content

Instantly share code, notes, and snippets.

View Arepo's full-sized avatar

Sasha Cooper Arepo

View GitHub Profile
@brunopgalvao
brunopgalvao / _form.html.erb
Last active December 23, 2022 02:32
HTML5 Datalist using Ruby on Rails form_for
<%= form_for @person do |f| %>
<%= f.label :first_name, "First Name" %>:
<%= f.text_field :first_name, list: 'first-name' %>
<datalist id="first-name">
<% Person.all.each do |person| %>
<option value="<%= person.first_name %>"></option>
<% end %>
</datalist>
<%= f.submit %>
<% end %>