Skip to content

Instantly share code, notes, and snippets.

@kennethdavidbuck
Created August 16, 2012 15:00
Show Gist options
  • Save kennethdavidbuck/3370836 to your computer and use it in GitHub Desktop.
Save kennethdavidbuck/3370836 to your computer and use it in GitHub Desktop.
Example of a premade form in RoR3.
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :email %><br />
<%= f.text_field :email %>
</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