Skip to content

Instantly share code, notes, and snippets.

@wolfieorama
Created April 26, 2016 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfieorama/79c011efb130e84020bad21ab50f834a to your computer and use it in GitHub Desktop.
Save wolfieorama/79c011efb130e84020bad21ab50f834a to your computer and use it in GitHub Desktop.
<%= form_for(@person) do |f| %>
<% if @person.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2>
<ul>
<% @person.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :person_name %><br>
<%= f.text_field :person_name %>
</div>
<div id="person_country_id" class="field">
<%= f.label :country %><br />
<%= f.collection_select :country_id, Country.order(:name), :id, :name, include_blank: true %>
</div>
<div id="person_city_id"class="field">
<%= f.label :city %><br />
<%= f.grouped_collection_select :city_id, Country.order(:name), :cities, :name, :id, :city_name, include_blank: true %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment